Requirements
Before installing Gooey Toast, make sure your environment meets these requirements:- PHP 8.1 or higher
- Laravel 10, 11, or 12
- Alpine.js (included with Livewire, or install manually)
Install via Composer
Install the package using Composer:Add the component to your layout
Add the Gooey Toast component to your main layout file, just before the closing</body> tag:
app.blade.php
The component must be placed before the closing
</body> tag to ensure proper rendering and functionality.Install Alpine.js (if not using Livewire)
Gooey Toast requires Alpine.js to function. If you’re already using Livewire, Alpine.js is included automatically. For non-Livewire projects, add Alpine to your layout:app.blade.php
Advanced setup: Separate styles and scripts
If you need more control over where styles and scripts are loaded, use the Blade directives instead of the component:app.blade.php
Publish configuration (optional)
To customize default settings like position, duration, and theme, publish the configuration file:config/gooey-toast.php with the following options:
config/gooey-toast.php
Configuration options explained
Configuration options explained
positionControls where toasts appear on screen. Available options:
bottom-center(default)bottom-righttop-centertop-right
0 to make toasts persistent by default. Individual toasts can override this value.max_toastsMaximum number of visible toasts. When exceeded, older toasts are stacked and a counter badge shows the number of hidden notifications.themeDefault color theme. Options are dark or light. You can switch themes at runtime using JavaScript.Publish views (optional)
If you need to customize the component markup, publish the views:resources/views/vendor/gooey-toast/. You can then modify:
components/container.blade.php- Main component structurepartials/styles.blade.php- CSS stylespartials/scripts.blade.php- JavaScript functionality
Verify installation
To verify everything is working, create a test route and trigger a simple toast:Visit the route
Navigate to
/test-toast in your browser. You should see a green success toast slide up from the bottom of the screen.Next steps
Now that Gooey Toast is installed, you’re ready to create your first toast notification:Quick start guide
Learn how to trigger toasts from JavaScript, Livewire, and PHP