joshdonnell/inertia-flash

Zero-config flash messages for Laravel + Inertia.js

Maintainers

Package info

github.com/joshdonnell/inertia-flash

pkg:composer/joshdonnell/inertia-flash

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-04-03 12:12 UTC

This package is auto-updated.

Last update: 2026-04-03 15:22:32 UTC


README

Zero-config flash messages for Laravel + Inertia.js

Latest Version on Packagist Total Downloads Tests

Example

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

Example

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:

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