- How do I install Laravel Notify in my Laravel project?
- Run `composer require mckenziearts/laravel-notify` to install via Composer. Then publish the config and assets with `php artisan vendor:publish --tag=notify-assets --tag=notify-config`. Follow the Tailwind or standalone setup instructions in the README.
- Does Laravel Notify work with Laravel 13?
- Yes, Laravel Notify supports Laravel 8.x through 13.x. Check the package’s `composer.json` for exact version constraints, but it’s actively maintained for modern Laravel releases. Downgrade if needed for older versions.
- Can I use Laravel Notify without Tailwind CSS?
- Yes, you can publish the package’s pre-compiled CSS/JS assets and include them manually in your layout. The package provides `@notifyCss` and `@notifyJs` directives for easy integration, though Tailwind integration is the recommended path for dynamic styling.
- How do I trigger a notification from a controller?
- Use the `notify()` helper method in your controller. For example, `notify()->success('Your action was completed!')` or `notify()->error('Something went wrong.')->withAction('Retry', route('action.retry'))` for interactive alerts.
- Will notifications persist across page reloads?
- No, notifications are session-based and rely on Laravel’s flash data. They’ll disappear after the next page load unless you manually re-flash them. For persistent notifications, consider storing them in a database or queue.
- Is Alpine.js required for notifications to work?
- Alpine.js is only required if you’re using the Tailwind CSS integration path for interactive features like auto-dismissal or action buttons. For static notifications, you can disable Alpine.js and use standalone CSS/JS.
- Can I customize the notification styles beyond Tailwind?
- Yes, publish the assets (`php artisan vendor:publish --tag=notify-assets`) to override the Blade views or CSS. You can modify the published `resources/views/vendor/notify` files or extend the Tailwind classes in your own CSS.
- Does Laravel Notify support non-Blade frontend frameworks like React or Vue?
- Not natively, as notifications rely on Laravel’s session flash data and Blade components. For React/Vue, you’d need to create a custom API endpoint to fetch notifications or use a middleware to store them in a database/queue for frontend consumption.
- How do I add custom actions (e.g., 'Undo') to notifications?
- Use the `withAction()` method when triggering a notification. For example, `notify()->warning('File deleted')->withAction('Restore', route('files.restore', $file))`. The package handles the button rendering and CSRF protection automatically.
- Are there alternatives to Laravel Notify for Laravel notifications?
- Yes, alternatives include `spatie/laravel-notification-directives` (for Blade directives), `laravel-notification-channels` (for email/SMS + UI), or `laravel-flash` for simpler flash messages. Laravel Notify stands out for its Tailwind/Alpine integration and lightweight design.