Getting started with Flare is a breeze. Follow these simple steps to integrate beautiful toast notifications into your Laravel application.
| Requirement | Version |
|---|---|
| PHP | ^8.1 |
| Laravel | ^10.0 or higher |
| Livewire | ^3.0 or higher |
| Alpine.js | 3.x |
| Tailwind | 4.x |
Require the package using Composer:
composer require alizharb/flare
Add the <x-flare::toast /> component to your main layout file. This is usually located at resources/views/components/layouts/app.blade.php.
[!TIP] Place the component near the end of the
<body>tag to ensure it renders on top of other content.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<!-- ... -->
[@livewireStyles](https://github.com/livewireStyles)
</head>
<body class="font-sans antialiased">
{{ $slot }}
<!-- Add Flare Component Here -->
<x-flare::toast />
[@livewireScripts](https://github.com/livewireScripts)
</body>
</html>
If you are using the default styling, you're good to go! Flare injects its styles automatically.
However, if you want to customize the styles or use the Tailwind classes directly in your build process, you can publish the views and assets.
php artisan vendor:publish --tag=flare-views
When upgrading to a new version of Flare, make sure to republish the assets if you have previously published them:
php artisan vendor:publish --tag=flare-assets --force
How can I help you explore Laravel packages today?