Elegant β’ Performant β’ Customizable
Features β’ Installation β’ Quick Start β’ Documentation β’ Themes β’ Examples
Flare is a modern, feature-rich toast notification system built specifically for Laravel Livewire applications. With zero configuration required and three distinct visual themes, Flare provides beautiful user feedback out of the box while offering extensive customization for advanced use cases.
// Simple, elegant API
Flare::success('Profile updated successfully!');
// Full control when you need it
Flare::warning(
text: 'Session expires in 5 minutes',
heading: 'Warning',
duration: 10000,
position: 'top center'
);
All themes include:
|
|
| Requirement | Version |
|---|---|
| PHP | 8.3+ |
| Laravel | 12.0+ |
| Livewire | 3.5+ |
| Alpine.js | 3.x (included in Livewire 3) |
composer require alizharb/flareIMPORTANT: Assets must be published for Flare to work.
php artisan vendor:publish --tag=flare-assets<!DOCTYPE html>
<html lang="en">
<head>
@flareStyles {{-- Required --}}
</head>
<body>
<flare::toasts /> {{-- Required --}}
@flareScripts {{-- Required --}}
</body>
</html>That's it! π You're ready to use Flare.
Optional Configuration
# Publish config file
php artisan vendor:publish --tag=flare-config
# Publish views for customization
php artisan vendor:publish --tag=flare-viewsPerfect for controllers, services, and any PHP class:
use AlizHarb\Flare\Facades\Flare;
class UserController extends Controller
{
public function store(Request $request)
{
User::create($request->validated());
Flare::success('User created successfully!');
return redirect()->route('users.index');
}
}The easiest way in Livewire components:
use Livewire\Component;
use AlizHarb\Flare\Concerns\WithFlare;
class CreatePost extends Component
{
use WithFlare;
public function save()
{
Post::create($this->validate());
$this->flareSuccess('Post published!', 'Success');
}
}For client-side notifications:
// Simple
Flare.success("Item added to cart!");
// Advanced
Flare.toast("Welcome back!", {
heading: "Hello User",
variant: "info",
duration: 5000,
position: "top center",
});Flare includes three professionally designed themes. Choose the one that fits your application's aesthetic.
|
Minimal & Professional Solid backgrounds 'theme' => 'classic' |
Balanced & Contemporary Subtle gradients 'theme' => 'modern' |
Bold & Colorful Strong gradients 'theme' => 'vibrant' |
All themes support light & dark modes automatically.
Visit our comprehensive documentation:
- Introduction - What is Flare?
- Installation - Detailed setup guide
- Quick Start - Get started in 5 minutes
- Playground - Try it live
- Themes - Visual customization
- Configuration - All options explained
- Examples - Real-world scenarios
Run the documentation website locally:
php -S localhost:8000 -t docsVisit http://localhost:8000 for interactive documentation.
Flare::success($text, $heading = null, $duration = 5000, $position = null);
Flare::warning($text, $heading = null, $duration = 5000, $position = null);
Flare::danger($text, $heading = null, $duration = 5000, $position = null);
Flare::error($text, $heading = null, $duration = 5000, $position = null); // Alias
Flare::info($text, $heading = null, $duration = 5000, $position = null);$this->flareSuccess($text, $heading = null, $duration = 5000, $position = null);
$this->flareWarning($text, $heading = null, $duration = 5000, $position = null);
$this->flareDanger($text, $heading = null, $duration = 5000, $position = null);
$this->flareError($text, $heading = null, $duration = 5000, $position = null);
$this->flareInfo($text, $heading = null, $duration = 5000, $position = null);Flare.toast(text, options);
Flare.success(text, options);
Flare.warning(text, options);
Flare.danger(text, options);
Flare.error(text, options);
Flare.info(text, options);View Complete Configuration
return [
// Visual theme
'theme' => 'modern', // classic, modern, vibrant
// Default position
'position' => 'bottom end',
// Default duration (ms)
'duration' => 5000,
// Stacking behavior
'enable_stacking' => true,
'stack_expanded' => false,
'max_visible' => 3,
// Features
'icons' => ['enabled' => true],
'actions' => ['enabled' => true],
'priority' => ['enabled' => true],
'rate_limit' => ['enabled' => true],
'progress_bar' => ['enabled' => true],
];FLARE_THEME=modern
FLARE_POSITION="bottom end"
FLARE_DURATION=5000
FLARE_ENABLE_STACKING=true
FLARE_STACK_EXPANDED=falseclass ContactForm extends Component
{
use WithFlare;
public function submit()
{
$this->validate([...]);
// Send email...
$this->flareSuccess(
text: "Thank you! We'll get back to you soon.",
heading: 'Message Sent',
duration: 7000
);
}
}public function destroy(Post $post)
{
$post->delete();
Flare::danger(
text: 'Post has been permanently deleted',
heading: 'Deleted',
duration: 4000
);
return redirect()->route('posts.index');
}// Requires manual dismissal
Flare::danger(
text: 'Critical error - please contact support',
heading: 'Error',
duration: 0 // Never auto-dismiss
);See EXAMPLES.md for more real-world scenarios.
| Shortcut | Action |
|---|---|
Esc |
Dismiss most recent toast |
Shift + Esc |
Dismiss all toasts |
Alt + D |
Dismiss all toasts (alternative) |
Flare includes a comprehensive test suite:
# Run tests
composer test
# Run tests with coverage
composer test:coverage
# Run static analysis
composer analyse
# Run code style fixer
composer formatTest Results: β 12 tests, 22 assertions, 100% passing
We welcome contributions! Please see CONTRIBUTING.md for details.
git clone https://github.com/alizharb/flare.git
cd flare
composer install
composer testSee CHANGELOG.md for all changes and version history.
- β¨ Three distinct themes (Classic, Modern, Vibrant)
- π Fixed all positioning issues
- β‘ Improved stacking performance
- π Added RTL/LTR support
- π Complete documentation
Flare is open-source software licensed under the MIT License.
Built with β€οΈ by Ali Harb
Special thanks to:
- Laravel & Livewire teams
- Alpine.js community
- All contributors
If you find Flare useful, please consider:
- β Starring the repository
- π Reporting bugs
- π‘ Suggesting features
- π Improving documentation
- π° Sponsoring development
Made with β€οΈ for the Laravel community