{"id":26085258,"url":"https://github.com/codezero-be/laravel-flash","last_synced_at":"2025-04-12T02:01:28.282Z","repository":{"id":32070318,"uuid":"35642195","full_name":"codezero-be/laravel-flash","owner":"codezero-be","description":"⭐️ Flash Notifications for Laravel","archived":false,"fork":false,"pushed_at":"2024-03-12T15:21:15.000Z","size":68,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T21:47:11.687Z","etag":null,"topics":["flash","form","laravel","message","notification","php","session"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codezero-be.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"ko_fi":"ivanvermeyen","custom":"https://paypal.me/ivanvermeyen"}},"created_at":"2015-05-14T23:24:13.000Z","updated_at":"2023-10-28T13:40:09.000Z","dependencies_parsed_at":"2024-03-12T16:49:31.698Z","dependency_job_id":null,"html_url":"https://github.com/codezero-be/laravel-flash","commit_stats":{"total_commits":47,"total_committers":1,"mean_commits":47.0,"dds":0.0,"last_synced_commit":"662e230817357e04b8d1098875fa0f20558fc351"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Flaravel-flash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Flaravel-flash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Flaravel-flash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Flaravel-flash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codezero-be","download_url":"https://codeload.github.com/codezero-be/laravel-flash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505862,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flash","form","laravel","message","notification","php","session"],"created_at":"2025-03-09T05:58:01.264Z","updated_at":"2025-04-12T02:01:28.251Z","avatar_url":"https://github.com/codezero-be.png","language":"PHP","funding_links":["https://ko-fi.com/ivanvermeyen","https://paypal.me/ivanvermeyen","https://ko-fi.com/R6R3UQ8V"],"categories":[],"sub_categories":[],"readme":"# Flash Notifications for Laravel\n\n[![GitHub release](https://img.shields.io/github/release/codezero-be/laravel-flash.svg?style=flat-square)](https://github.com/codezero-be/laravel-flash/releases)\n[![Laravel](https://img.shields.io/badge/laravel-11-red?style=flat-square\u0026logo=laravel\u0026logoColor=white)](https://laravel.com)\n[![License](https://img.shields.io/packagist/l/codezero/laravel-flash.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/codezero-be/laravel-flash/run-tests.yml?style=flat-square\u0026logo=github\u0026logoColor=white\u0026label=tests)](https://github.com/codezero-be/laravel-flash/actions)\n[![Code Coverage](https://img.shields.io/codacy/coverage/22d50bd2782540bb806f576966a5f5d5/master?style=flat-square)](https://app.codacy.com/gh/codezero-be/laravel-flash)\n[![Code Quality](https://img.shields.io/codacy/grade/22d50bd2782540bb806f576966a5f5d5/master?style=flat-square)](https://app.codacy.com/gh/codezero-be/laravel-flash)\n[![Total Downloads](https://img.shields.io/packagist/dt/codezero/laravel-flash.svg?style=flat-square)](https://packagist.org/packages/codezero/laravel-flash)\n\n[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R3UQ8V)\n\n#### Flash messages to the session with [Laravel](http://laravel.com/).\n\n## 🧩 Features\n\n- Flash multiple messages.\n- Use built in notification levels (success, error, ...) or imagine your own.\n\n## ✅ Requirements\n\n- PHP \u003e= 8.1\n- Laravel \u003e= 10.0\n\n## 📦 Install\n\n```bash\ncomposer require codezero/laravel-flash\n```\n\n\u003e Laravel will automatically register the ServiceProvider.\n\n## 🛠 Usage\n\nSomewhere in your views, include the flash notifications partial:\n\n```blade\n@include('flash::notifications')\n```\n\nThen you can flash a message to the session in your controllers.\n\n```php\nflash()-\u003esuccess('Update succeeded!');\n```\n\n\u003e You can also use the facade `\\CodeZero\\Flash\\Facades\\Flash` instead of the `flash()` helper.\n\nThe message will be displayed once on the next page load.\n\n## 🚨 Notification Levels\n\nYou can use the built in notification levels:\n\n```php\nflash()-\u003einfo('info message');\nflash()-\u003esuccess('success message');\nflash()-\u003ewarning('warning message');\nflash()-\u003eerror('error message');\n```\n\nOr you can specify a custom level:\n\n```php\nflash()-\u003enotification('message', 'level');\n```\n\n## 🔖 Rendering Notifications\n\n### Customize the notification views\n\nIf you want to customize the templates, you can publish the views:\n\n```bash\nphp artisan vendor:publish --provider=\"CodeZero\\Flash\\FlashServiceProvider\" --tag=\"views\"\n```\n\nYou will find the views in `resources/views/vendor/flash`.\n\n### Default views for built in notification levels\n\nA notification will be rendered using a view file which name corresponds with the notification level.\n\nSo `flash()-\u003esuccess('message')` will load a `success.blade.php` view file.\n\nThese views live in `resources/views/vendor/flash/notifications`.\n\n### Default view for custom notification levels\n\nIf no corresponding file can be found in the package's view folder, then the `default.blade.php` view file will be used.\n\nSo `flash()-\u003enotification('message', 'custom')` will load the `default.blade.php` view file.\n\nThis view lives in `resources/views/vendor/flash/notifications`.\n\n### Add views for custom notification levels\n\nTo add view files for custom levels, create them in `resources/views/vendor/flash/notifications`.\n\n### Override default notification views\n\nYou can override the view file to be used when you flash a notification:\n\n```php\n// use 'resources/views/custom.blade.php' instead of\n// 'resources/views/vendor/flash/notifications/success.blade.php'\nflash()-\u003esuccess('message')-\u003esetView('custom');\n```\n\nThe specified view name is relative to your app's view folder `resources/views`.\n\n### Access notification values in a view\n\nNotification views will have a `$notification` variable which is an instance of `\\CodeZero\\Flash\\Notification`.\n\nThis gives you access to:\n\n```blade\n{{ $notification-\u003emessage }}\n{{ $notification-\u003elevel }}\n```\n\n## 🔧 Create Your Own Custom Flash Class\n\nIf you don't want to use the built in notification levels and want to create your own, you can extend the `\\CodeZero\\Flash\\BaseFlash` class.\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse CodeZero\\Flash\\BaseFlash;\n\nclass YourCustomFlash extends BaseFlash\n{\n    /**\n     * Flash a notification.\n     *\n     * @param string $message\n     *\n     * @return \\CodeZero\\Flash\\Notification\n     */\n    public function danger($message)\n    {\n        return $this-\u003enotification($message, 'danger');\n    }\n}\n```\n\nThen change the `flash` binding in the `register` method of your `app/Providers/AppServiceProvider`:\n\n```php\npublic function register()\n{\n    $this-\u003eapp-\u003ebind('flash', \\App\\YourCustomFlash::class);\n}\n```\n\n## ⚙️ Publish Configuration File\n\n```bash\nphp artisan vendor:publish --provider=\"CodeZero\\Flash\\FlashServiceProvider\" --tag=\"config\"\n```\n\nYou will now find a `flash.php` file in the `config` folder.\n\n## 🚧 Testing\n\n```bash\ncomposer test\n```\n\n## ☕️ Credits\n\n- [Ivan Vermeyen](https://byterider.io)\n- [All contributors](../../contributors)\n\n## 🔓 Security\n\nIf you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.\n\n## 📑 Changelog\n\nA complete list of all notable changes to this package can be found on the\n[releases page](https://github.com/codezero-be/laravel-flash/releases).\n\n## 📜 License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodezero-be%2Flaravel-flash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodezero-be%2Flaravel-flash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodezero-be%2Flaravel-flash/lists"}