Elegant toast notifications for Laravel and Inertia.js applications.
Project details
Laravel Inertia Toast is an opinionated package designed for creating beautiful toast notifications in Laravel applications using Inertia.js. It offers a fluent PHP API, seamless integration with Vue 3 and React, and supports multi-toast management, all styled with Tailwind CSS. Enhance user experience effortlessly by triggering notifications from both the backend and frontend.
Laravel Inertia Toast is a robust package designed to integrate visually appealing toast notifications into Laravel + Inertia.js applications. It offers a fluent PHP API, supports multiple toasts, ensures redirect safety, and provides dedicated adapters for Vue 3 and React.
Toast::success('Saved!') or toast('Profile updated!')->success().useToast() composable/hook on the frontend.use InertiaToast\Facades\Toast;
// Triggering toast notifications in a controller
Toast::success('Profile updated!');
Toast::error('Something went wrong.');
Toast::info('Check your email for a confirmation link.');
Toast::warning('Your subscription is about to expire.');
return redirect()->route('dashboard');
<script setup>
import { useToast } from '@laravel-inertia-toast/vue';
const { success } = useToast();
function handleClick() {
success('Copied to clipboard!');
}
</script>
import { useToast } from '@laravel-inertia-toast/react';
function MyComponent() {
const { success } = useToast();
return (
<button onClick={() => success('Copied to clipboard!')}>Copy</button>
);
}
For a demo, visit the repository's examples showcasing the PHP backend, React, and Vue frontend implementations. The interactive element demonstrates the toast notifications in action, providing users with a hands-on understanding of its capabilities.
Integrate Laravel Inertia Toast into your application to enhance user experience with elegant and responsive toast notifications.
Comments
0Start the conversation
Share the first comment.