One line of PHP. Beautiful notifications. Zero JavaScript.
Documentation · Live Playground · Report Bug
Laravel:
composer require php-flasher/flasher-laravel && php artisan flasher:installSymfony:
composer require php-flasher/flasher-symfony && php bin/console flasher:installThat's it! Now use it:
flash()->success('Welcome aboard! Your account is ready.');| PHPFlasher | Others | |
|---|---|---|
| Zero JavaScript | Write PHP only, frontend handled automatically | Requires manual JS setup |
| Auto Asset Injection | CSS/JS injected automatically | Manual script tags needed |
| 17 Built-in Themes | Amazon, iOS, Slack, Material & more | Limited or no themes |
| 4 Notification Libraries | Toastr, SweetAlert, Noty, Notyf | Single library only |
| Livewire Integration | Full event system support | Limited or none |
| RTL Support | Built-in right-to-left | Often missing |
| Framework Agnostic | Laravel, Symfony, or vanilla PHP | Framework-specific |
flash()->success('Operation completed successfully!');
flash()->error('Oops! Something went wrong.');
flash()->warning('Please backup your data before continuing.');
flash()->info('A new version is available for download.');flash()->success('Your changes have been saved.', 'Update Complete');
flash()->error('Unable to connect to server.', 'Connection Failed');flash()->success('Profile updated!', [
'position' => 'bottom-right',
'timeout' => 10000,
]);PHPFlasher includes 17 professionally designed themes ready to use:
flash()->success('Welcome!', ['theme' => 'amazon']);
flash()->success('Welcome!', ['theme' => 'ios']);
flash()->success('Welcome!', ['theme' => 'slack']);
flash()->success('Welcome!', ['theme' => 'material']);View All Themes
| Theme | Style |
|---|---|
flasher |
Default clean design |
amazon |
Amazon-inspired e-commerce |
ios |
Apple iOS notifications |
slack |
Slack messaging style |
material |
Google Material Design |
google |
Google notifications |
facebook |
Facebook style |
minimal |
Ultra-clean minimal |
amber |
Warm amber tones |
aurora |
Gradient effects |
crystal |
Transparent design |
emerald |
Modern green palette |
jade |
Soft jade colors |
neon |
Bright attention-grabbing |
onyx |
Dark mode sleek |
ruby |
Bold ruby accents |
sapphire |
Elegant blue style |
Need more features? Use popular notification libraries:
composer require php-flasher/flasher-toastr-laraveltoastr()->success('Profile saved!', [
'positionClass' => 'toast-bottom-right',
'progressBar' => true,
]);composer require php-flasher/flasher-sweetalert-laravelsweetalert()
->showDenyButton()
->showCancelButton()
->warning('Do you want to save changes?');composer require php-flasher/flasher-noty-laravelnoty()->success('Data synchronized!', [
'layout' => 'topCenter',
'timeout' => 3000,
]);composer require php-flasher/flasher-notyf-laravelnotyf()->success('Upload complete!', [
'dismissible' => true,
'ripple' => true,
]);PHPFlasher integrates seamlessly with Laravel Livewire:
use Livewire\Attributes\On;
class UserProfile extends Component
{
public function save()
{
// Save logic...
sweetalert()
->showDenyButton()
->success('Save changes?');
}
#[On('sweetalert:confirmed')]
public function onConfirmed(array $payload): void
{
// User clicked confirm
$this->user->save();
flash()->success('Profile saved!');
}
#[On('sweetalert:denied')]
public function onDenied(array $payload): void
{
// User clicked deny
}
}// config/flasher.php
return [
'default' => 'flasher',
'themes' => [
'flasher' => [
'options' => [
'timeout' => 5000,
'position' => 'top-right',
],
],
],
];# config/packages/flasher.yaml
flasher:
default: flasher
themes:
flasher:
options:
timeout: 5000
position: top-right| Option | Type | Default | Description |
|---|---|---|---|
timeout |
int | 5000 |
Auto-dismiss delay in ms (0 = sticky) |
position |
string | top-right |
top-right, top-left, bottom-right, bottom-left, top-center, bottom-center |
closeButton |
bool | true |
Show close button |
progressBar |
bool | true |
Show timeout progress bar |
rtl |
bool | false |
Right-to-left text direction |
escapeHtml |
bool | true |
Escape HTML in messages |
| Requirement | Version |
|---|---|
| PHP | >= 8.2 |
| Laravel | >= 11.0 |
| Symfony | >= 7.0 |
For complete documentation, visit php-flasher.io
- Installation Guide
- Laravel Integration
- Symfony Integration
- Livewire Integration
- Inertia.js Integration
- Themes Gallery
- JavaScript Usage
Contributions are welcome! Please feel free to submit a Pull Request.
If PHPFlasher helps you build better applications, please consider:
- Star this repository to show your support
- Report bugs to help improve the library
- Share on Twitter to spread the word
PHPFlasher is open-source software licensed under the MIT license.
Made with ❤️ by Younes ENNAJI
⭐ Star if you find this useful!