narutimateum / toastr-5.2-laravel by narutimateum

toastr.js for Laravel 5.2 easy notification like growl for example
Package Data
Maintainer Username: narutimateum
Maintainer Contact: (Harith Roslin)
Package Create Date: 2016-01-30
Package Last Update: 2016-10-18
Language: PHP
License: MIT
Last Refreshed: 2021-02-28 15:29:45
Package Statistics
Total Downloads: 37,567
Monthly Downloads: 761
Daily Downloads: 14
Total Stars: 13
Total Watchers: 3
Total Forks: 7
Total Open Issues: 1


toastr.js for Laravel 5.2


to install plugin via Bower run

bower install toastr

###1 Link to toastr.css <link href="toastr.css" rel="stylesheet"/>

###2 Link to toastr.js <script src="toastr.js"></script>


  1. Either run composer require narutimateum/toastr-5.2-laravel or add "narutimateum/toastr-5.2-laravel": "dev-master" to the require key in composer.json and run composer install

  2. Add 'narutimateum\Toastr\ToastrServiceProvider', to the providers key in config/app.php

  3. Add 'Toastr' => 'narutimateum\Toastr\Facades\Toastr', to the aliases key in config/app.php


Include jQuery and toastr.js and plugin styles in your master view template

after everything is done do

{!! Toastr::render() !!}

in your template just bofore body closing tag or after toastr.js script instantiated in your file.

You can use these methods in your controllers to insert a toast:

  • Toastr::warning($message, $title = null, $options = []) - add a warning toast
  • Toastr::error($message, $title = null, $options = []) - add an error toast
  • Toastr::info($message, $title = null, $options = []) - add an info toast
  • Toastr::success($message, $title = null, $options = []) - add a success toast
  • Toastr::add($type: warning|error|info|success, $message, $title = null, $options = []) - add a toast
  • Toastr::clear() - clear all current toasts don't forget to use it

Setting custom Toastr options

You can set custom options for Toastr. Run:

php artisan vendor:publish

to publish the config file for Toastr. Then edit config/toastr.php and set the options array to whatever you want to pass to Toastr. These options are set as the default options and can be overridden by passing an array of options to any of the methods in the Usage section.

###for example###


return [
    'options' => 
    ["progressBar" => true,
    "positionClass" =>"toast-bottom-right",
    "preventDuplicates"=> false,
    "showDuration" => 300,
    "hideDuration" => 1000,
    "timeOut" => 5000,
    "extendedTimeOut" => 1000,
    "showEasing" => "swing",
    "hideEasing"=> "linear",
    "showMethod" => "fadeIn",
    "hideMethod" => "fadeOut"]

For a list of available options, see toastr.js' documentation.