Блог Серії
Кар'єра
Вакансії Компанії
Навчання
Співбесіди Тестування Відео
Екосистема
Пакети Ресурси Проєкти
Інше
Події Про нас

Toastr

yoeunes/toastr
v3.3.0 412 1.1M 31 грудня 2025 4
На GitHub

Інтеграція toastr.js для відправлення повідомлень сповіщень у Laravel.

Поділитись

README

Toastr.js notifications for Laravel

:eyes: This package helps you to add toastr.js notifications to your Laravel projects.

Latest Stable Version Latest Unstable Version Total Downloads License

toastr

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

Коментарі

Увійдіть, щоб залишити коментар

Будьте першим, хто залишить коментар!

Схожі пакети

Laravel Notify

mckenziearts/laravel-notify

Гнучка система flash-повідомлень для Laravel, яка дозволяє легко створювати та відображати тимчасові сповіщення користувачам.

1,730 v3.2.0 13 2

Sweet Alert

realrashid/sweet-alert

Пакет для Laravel, що забезпечує зручний спосіб відображення повідомлень про сповіщення за допомогою бібліотеки SweetAlert2.

1,162 v7.3.2 13 3

Laravel Flash

spatie/laravel-flash

Легкий пакет для виведення flash-повідомлень.

669 1.10.2 3

Laravel Toaster Magic

devrabiul/laravel-toaster-magic

Легка та гнучка бібліотека для виведення сповіщень у Laravel-проєктах без залежностей від jQuery, Bootstrap чи Tailwind.

225 2.3.0 13 3