joshdonnell / inertia-flash
Zero-config flash messages for Laravel + Inertia.js
v0.1.0
2026-04-03 12:12 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0||^12.0||^13.0
- inertiajs/inertia-laravel: ^2.3.3 || ^3.0.1
- spatie/laravel-package-tools: ^1.93
Requires (Dev)
- larastan/larastan: ^3.9.3
- laravel/pint: ^1.29
- nunomaduro/collision: ^8.9.2
- orchestra/testbench: ^10.11.0||^9.0.0
- pestphp/pest: ^4.4.3
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.1
- pestphp/pest-plugin-type-coverage: ^4.0.3
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan-deprecation-rules: ^2.0.4
- phpstan/phpstan-phpunit: ^2.0.16
- rector/rector: >=2.3.9
README
Zero-config flash messages for Laravel + Inertia.js
Requirements
- PHP ^8.2
- Laravel ^10.0, ^11.0, ^12.0, or ^13.0
- Inertia Laravel ^2.3.3 or ^3.0.1
Installation
composer require joshdonnell/inertia-flash
Then run the install command:
php artisan flash:init
The init command will:
- Optionally publish the config file
- Ask which frontend framework you're using (Vue, React, or Svelte)
- Display framework-specific setup instructions
Frontend Adapters
Install the adapter for your frontend framework and import its stylesheet:
- Vue — inertia-flash-vue
- React — inertia-flash-react
- Svelte — inertia-flash-svelte
See each adapter's README for full setup and customisation options.
Usage
Basic Messages
use JoshDonnell\InertiaFlash\Facades\Flash; Flash::success('Profile updated.'); Flash::error('Something went wrong.'); Flash::warning('Your session is about to expire.'); Flash::info('A new version is available.');
Fluent API
Chain methods to customize individual messages:
Flash::success('Order placed!') ->title('Thank you') ->duration(8000) ->dismissible(false) ->meta(['orderId' => $order->id]);
Configuration
Publish the config file:
php artisan vendor:publish --tag=inertia-flash-config
return [ 'default_duration' => 5000, // Auto-dismiss after 5s (0 = disabled) 'position' => 'top-right', // top-right, top-left, bottom-right, bottom-left, top-center, bottom-center 'max_visible' => 5, // Max toasts visible at once 'dismissible' => true, // Dismissible by default ];
Visual customisation (colours, borders, shadows, icons) is handled by the frontend adapter — see the adapter README for details.
Testing
composer test # Run all checks (lint + types + unit) composer lint # Apply code style fixes (Rector + Pint) composer test:lint # Check code style (dry-run) composer test:types # Run PHPStan analysis composer test:unit # Run Pest unit tests
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License. See LICENSE for more information.
Credits
- Built for Inertia.js + Laravel
- Josh Donnell

