├── LICENSE ├── README.md └── composer.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 yoeunes 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 |

Toastr.js notifications for Laravel

2 | 3 |

:eyes: This package helps you to add toastr.js notifications to your Laravel projects.

4 | 5 |

6 | Latest Stable Version 7 | Latest Unstable Version 8 | Total Downloads 9 | License 10 |

11 | 12 |

toastr

13 | 14 | ## Version 3 Update 15 | 16 | With the release of version 3, `yoeunes/toastr` is now powered by [PHPFlasher](https://github.com/php-flasher/php-flasher). When you install this package, it automatically utilizes [PHPFlasher](https://packagist.org/packages/php-flasher/flasher-toastr-laravel) under the hood. For those who are already using [PHPFlasher](https://php-flasher.io/library/toastr/) or are interested in a more direct implementation, you might consider using [PHPFlasher](https://php-flasher.io/library/toastr/) directly as it offers the same API and additional features. 17 | 18 | ## Install 19 | 20 | You can install the package using composer 21 | 22 | ```sh 23 | composer require yoeunes/toastr 24 | ``` 25 | 26 | After installation, publish the assets using: 27 | 28 | ```bash 29 | php artisan flasher:install 30 | ``` 31 | 32 | ## Usage: 33 | 34 | The usage of this package is very simple and straightforward. it only required one step to use it : 35 | 36 | Use `toastr()` helper function inside your controller to set a toast notification for `info`, `success`, `warning` or `error` 37 | 38 | ```php 39 | // Display a success toast with no title 40 | flash()->success('Operation completed successfully.'); 41 | ``` 42 | 43 | As an example: 44 | 45 | ```php 46 | only(['title', 'body'])); 59 | 60 | if ($post instanceof Model) { 61 | toastr()->success('Data has been saved successfully!'); 62 | 63 | return redirect()->route('posts.index'); 64 | } 65 | 66 | toastr()->error('An error has occurred please try again later.'); 67 | 68 | return back(); 69 | } 70 | } 71 | ``` 72 | 73 | ## License 74 | 75 | MIT 76 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yoeunes/toastr", 3 | "description": "toastr.js flush notifications for Laravel", 4 | "license": "MIT", 5 | "type": "library", 6 | "keywords": [ 7 | "laravel", 8 | "toastr", 9 | "flash-notifications", 10 | "dynamic-notifications", 11 | "phpflasher", 12 | "user-feedback", 13 | "open-source" 14 | ], 15 | "authors": [ 16 | { 17 | "name": "Younes ENNAJI", 18 | "email": "younes.ennaji.pro@gmail.com", 19 | "homepage": "https://www.linkedin.com/in/younes--ennaji/", 20 | "role": "Developer" 21 | } 22 | ], 23 | "homepage": "https://github.com/yoeunes/toastr", 24 | "support": { 25 | "email": "younes.ennaji.pro@gmail.com", 26 | "issues": "https://github.com/php-flasher/php-flasher/issues", 27 | "source": "https://github.com/php-flasher/php-flasher", 28 | "docs": "https://php-flasher.io" 29 | }, 30 | "require": { 31 | "php": ">=8.2", 32 | "php-flasher/flasher-toastr-laravel": "^2.1.6" 33 | }, 34 | "minimum-stability": "dev", 35 | "prefer-stable": true, 36 | "config": { 37 | "sort-packages": true 38 | } 39 | } 40 | --------------------------------------------------------------------------------