├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── screenshot-404.png ├── screenshot-500.png └── src ├── LaravelErrorViewsServiceProvider.php ├── assets └── svg │ ├── 403.svg │ ├── 404.svg │ ├── 500.svg │ └── 503.svg ├── config └── laravel-error-views.php └── views └── errors ├── 403.blade.php ├── 404.blade.php ├── 500.blade.php ├── 503.blade.php └── layout.blade.php /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: dotmarn # Replace with a single Buy Me a Coffee username 14 | thanks_dev: https://thanks.dev/p/gh/dotmarn # Replace with a single thanks.dev username 15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .vscode 3 | vendor 4 | composer.lock -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Ridwan Kasim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Custom Error Views 2 | 3 | [![Latest Stable Version](https://poser.pugx.org/dotmarn/laravel-error-views/v)](https://packagist.org/packages/dotmarn/laravel-error-views) 4 | [![License](https://poser.pugx.org/dotmarn/laravel-error-views/license)](LICENSE) 5 | [![PHP Version Require](https://poser.pugx.org/dotmarn/laravel-error-views/require/php)](https://packagist.org/packages/dotmarn/laravel-error-views) 6 | [![Build Status](https://scrutinizer-ci.com/g/dotmarn/laravel-error-views/badges/build.png?b=main)](https://scrutinizer-ci.com/g/dotmarn/laravel-error-views/build-status/main) 7 | 8 | This is a laravel package that offers you customized and beautiful error screens designed with TailwindCSS. 9 | 10 | ### Screenshots 11 | ![Screenshot](screenshot-404.png) 12 | 13 | ## Installation 14 | 15 | Begin by installing this package through Composer. Edit your project's `composer.json` file to require the package or simply run the following command: 16 | 17 | ```bash 18 | composer require dotmarn/laravel-error-views 19 | 20 | ``` 21 | 22 | ### Publishing the views 23 | 24 | This command will publish all the necessary assets to your project's `public/` and `resources/views/` directory. 25 | 26 | ```bash 27 | php artisan vendor:publish --tag=laravel-error-views:assets 28 | ``` 29 | 30 | ### Publishing the configuration 31 | 32 | The command below will publish the configuration file `laravel-error-views.php` to your project's `config/` directory with some defaults. 33 | 34 | ```bash 35 | php artisan vendor:publish --tag=laravel-error-views:config 36 | ``` 37 | 38 | ```php 39 | [ 52 | '403' => env('LARAVEL_ERROR_VIEWS_403_TITLE', 'Action or Page not authorized!!!'), 53 | '404' => env('LARAVEL_ERROR_VIEWS_404_TITLE', 'Page Not Found!'), 54 | '500' => env('LARAVEL_ERROR_VIEWS_500_TITLE', 'Whoops!!! Something went wrong.'), 55 | '503' => env('LARAVEL_ERROR_VIEWS_503_TITLE', 'Whoops!!! Service is currently unavailable') 56 | ], 57 | 58 | /* 59 | |-------------------------------------------------------------------------- 60 | | Default Messages 61 | |-------------------------------------------------------------------------- 62 | | 63 | | Here you may specify the message that will be displayed for each of the error pages 64 | | 65 | */ 66 | 'message' => [ 67 | '403' => env('LARAVEL_ERROR_VIEWS_403_MESSAGE', 'Sorry, You do not have access to this page or resource.'), 68 | '404' => env('LARAVEL_ERROR_VIEWS_404_MESSAGE', 'It seems the page or resource you are looking for doesn\'t exist or has been moved.'), 69 | '500' => env('LARAVEL_ERROR_VIEWS_500_MESSAGE', 'Whoops!!! It\'s not you, it\'s us. Please try again.'), 70 | '503' => env('LARAVEL_ERROR_VIEWS_503_MESSAGE', 'Sorry, we are doing some maintenance. Please try again in few minutes.') 71 | ], 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | Customizing the colors for both the title, message and, back button 76 | |-------------------------------------------------------------------------- 77 | | 78 | | Here you may specify the text colors for both the title & message 79 | | 80 | */ 81 | 'colors' => [ 82 | 'text' => [ 83 | 'title' => env('LARAVEL_ERROR_VIEWS_COLORS_TITLE', 'text-gray-700'), 84 | 'message' => env('LARAVEL_ERROR_VIEWS_COLORS_MESSAGE', 'text-gray-500') 85 | ], 86 | 'button' => [ 87 | 'text' => env('LARAVEL_ERROR_VIEWS_COLORS_BUTTON_TEXT', 'text-purple-600') 88 | ] 89 | ], 90 | 91 | ]; 92 | ``` 93 | 94 | ### (Optional) 95 | 96 | If you will like to override the package's default titles and messages, you can edit the `.env` file and add the following: 97 | 98 | ```bash 99 | LARAVEL_ERROR_VIEWS_404_TITLE="My Custom Title" 100 | LARAVEL_ERROR_VIEWS_404_MESSAGE="My Custom Message" 101 | ``` 102 | 103 | ### Contributing 104 | 105 | Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities. 106 | 107 | ### How can I thank you? 108 | 109 | Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter. 110 | 111 | Don't forget to [follow me on twitter](https://twitter.com/oluwalosheyii)! 112 | 113 | ### License 114 | 115 | The MIT License (MIT). Please see [License File](LICENSE) for more information. -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dotmarn/laravel-error-views", 3 | "description": "A set of customised error pages/screens designed using the TailwindCSS for use in Laravel projects.", 4 | "type": "library", 5 | "license": "MIT", 6 | "homepage": "https://github.com/dotmarn/laravel-error-views", 7 | "authors": [ 8 | { 9 | "name": "Ridwan Kasim", 10 | "email": "kasimsheyi20@gmail.com", 11 | "role": "Owner" 12 | } 13 | ], 14 | "keywords": [ 15 | "Laravel", 16 | "TailwindCSS", 17 | "Laravel Error Views", 18 | "Custom Error Screens", 19 | "TALL", 20 | "Laravel Framework" 21 | ], 22 | "require": { 23 | "php": ">=8.0", 24 | "laravel/framework": "^8.0|^9.0|^10.0|^11.0" 25 | }, 26 | "autoload": { 27 | "psr-4": { 28 | "Dotman\\LaravelErrorViews\\": "src/" 29 | } 30 | }, 31 | "config": { 32 | "sort-packages": true 33 | }, 34 | "extra": { 35 | "laravel": { 36 | "providers": [ 37 | "Dotman\\LaravelErrorViews\\LaravelErrorViewsServiceProvider" 38 | ] 39 | } 40 | }, 41 | "minimum-stability": "dev", 42 | "prefer-stable": true 43 | } -------------------------------------------------------------------------------- /screenshot-404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotmarn/laravel-error-views/76678e5bae7b157a6db19aab337640ff0307bf1b/screenshot-404.png -------------------------------------------------------------------------------- /screenshot-500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotmarn/laravel-error-views/76678e5bae7b157a6db19aab337640ff0307bf1b/screenshot-500.png -------------------------------------------------------------------------------- /src/LaravelErrorViewsServiceProvider.php: -------------------------------------------------------------------------------- 1 | publishViews(); 18 | $this->publishConfiguration(); 19 | } 20 | 21 | protected function publishViews(): void 22 | { 23 | $this->publishes([ 24 | __DIR__ . '/views/errors' => resource_path('views/errors'), 25 | __DIR__ . '/assets/svg' => public_path('vendor/laravel-error-views/svg'), 26 | ], 'laravel-error-views:assets'); 27 | } 28 | 29 | protected function publishConfiguration(): void 30 | { 31 | $this->publishes([ 32 | __DIR__ . '/config/laravel-error-views.php' => config_path('laravel-error-views.php'), 33 | ], 'laravel-error-views:config'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/assets/svg/403.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/assets/svg/404.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/assets/svg/500.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/assets/svg/503.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/config/laravel-error-views.php: -------------------------------------------------------------------------------- 1 | [ 14 | '403' => env('LARAVEL_ERROR_VIEWS_403_TITLE', 'Action or Page not authorized!!!'), 15 | '404' => env('LARAVEL_ERROR_VIEWS_404_TITLE', 'Page Not Found!'), 16 | '500' => env('LARAVEL_ERROR_VIEWS_500_TITLE', 'Whoops!!! Something went wrong.'), 17 | '503' => env('LARAVEL_ERROR_VIEWS_503_TITLE', 'Whoops!!! Service is currently unavailable') 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Default Messages 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the message that will be displayed for each of the error pages 26 | | 27 | */ 28 | 'message' => [ 29 | '403' => env('LARAVEL_ERROR_VIEWS_403_MESSAGE', 'Sorry, You do not have access to this page or resource.'), 30 | '404' => env('LARAVEL_ERROR_VIEWS_404_MESSAGE', 'It seems the page or resource you are looking for doesn\'t exist or has been moved.'), 31 | '500' => env('LARAVEL_ERROR_VIEWS_500_MESSAGE', 'Whoops!!! It\'s not you, it\'s us. Please try again.'), 32 | '503' => env('LARAVEL_ERROR_VIEWS_503_MESSAGE', 'Sorry, we are doing some maintenance. Please try again in few minutes.') 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Customizing the colors for both the title, message and, back button 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the text colors for both the title & message 41 | | 42 | */ 43 | 'colors' => [ 44 | 'text' => [ 45 | 'title' => env('LARAVEL_ERROR_VIEWS_COLORS_TITLE', 'text-gray-700'), 46 | 'message' => env('LARAVEL_ERROR_VIEWS_COLORS_MESSAGE', 'text-gray-500') 47 | ], 48 | 'button' => [ 49 | 'text' => env('LARAVEL_ERROR_VIEWS_COLORS_BUTTON_TEXT', 'text-purple-600') 50 | ] 51 | ], 52 | 53 | ]; -------------------------------------------------------------------------------- /src/views/errors/403.blade.php: -------------------------------------------------------------------------------- 1 | @extends('errors::layout') 2 | 3 | @section('page-title', '403::'.config('laravel-error-views.title.403')) 4 | 5 | @section('title', __(config('laravel-error-views.title.403'))) 6 | 7 | @section('logo') 8 | 403 9 | @endsection 10 | 11 | @section('message', __(config('laravel-error-views.message.403'))) -------------------------------------------------------------------------------- /src/views/errors/404.blade.php: -------------------------------------------------------------------------------- 1 | @extends('errors::layout') 2 | 3 | @section('page-title', '404::'.config('laravel-error-views.title.404')) 4 | 5 | @section('title', __(config('laravel-error-views.title.404'))) 6 | 7 | @section('logo') 8 | 404 9 | @endsection 10 | 11 | @section('message', __(config('laravel-error-views.message.404'))) -------------------------------------------------------------------------------- /src/views/errors/500.blade.php: -------------------------------------------------------------------------------- 1 | @extends('errors::layout') 2 | 3 | @section('page-title', '500::'.__(config('laravel-error-views.title.500'))) 4 | 5 | @section('title', __(config('laravel-error-views.title.500'))) 6 | 7 | @section('logo') 8 | 500 9 | @endsection 10 | 11 | @section('message', __(config('laravel-error-views.message.500'))) -------------------------------------------------------------------------------- /src/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | @extends('errors::layout') 2 | 3 | @section('page-title', '503::'.__(config('laravel-error-views.title.503'))) 4 | 5 | @section('title', __(config('laravel-error-views.title.503'))) 6 | 7 | @section('logo') 8 | 503 9 | @endsection 10 | 11 | @section('message', __(config('laravel-error-views.message.503'))) -------------------------------------------------------------------------------- /src/views/errors/layout.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | @yield('page-title') 9 | 10 | 11 | 12 | 15 | 46 | 47 | 48 | 49 |
50 |
51 |
52 | @yield('logo') 53 |
54 |

55 | @yield('title')

56 | 57 |

@yield('message')

58 | 59 | 72 |
73 |
74 |
75 |
76 | 77 | 78 | 79 | --------------------------------------------------------------------------------