Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Toastr Laravel Package

yoeunes/toastr

Laravel toast notifications powered by toastr.js via PHPFlasher. Install with Composer and publish assets, then trigger info/success/warning/error messages using the flash()/toastr() helper in controllers for quick user feedback.

View on GitHub
Deep Wiki
Context7

Version 3 Update

With the release of version 3, yoeunes/toastr is now powered by PHPFlasher. When you install this package, it automatically utilizes PHPFlasher under the hood. For those who are already using PHPFlasher or are interested in a more direct implementation, you might consider using PHPFlasher directly as it offers the same API and additional features.

Install

You can install the package using composer

composer require yoeunes/toastr

After installation, publish the assets using:

php artisan flasher:install

Usage:

The usage of this package is very simple and straightforward. it only required one step to use it :

Use toastr() helper function inside your controller to set a toast notification for info, success, warning or error

// Display a success toast with no title
flash()->success('Operation completed successfully.');

As an example:

<?php

namespace App\Http\Controllers;

use App\Post;
use App\Http\Requests\PostRequest;
use Illuminate\Database\Eloquent\Model;

class PostController extends Controller
{
    public function store(PostRequest $request)
    {
        $post = Post::create($request->only(['title', 'body']));

        if ($post instanceof Model) {
            toastr()->success('Data has been saved successfully!');

            return redirect()->route('posts.index');
        }

        toastr()->error('An error has occurred please try again later.');

        return back();
    }
}

License

MIT

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4