PHPackages                             dongrim/laravel-toastr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. dongrim/laravel-toastr

ActivePackage[Mail &amp; Notifications](/categories/mail)

dongrim/laravel-toastr
======================

Toast notifications for laravel 5.5+, 6 and 7

2.0.0(3y ago)18MITPHPPHP &gt;=7.0

Since May 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/YaroslavFedan/laravel-toastr)[ Packagist](https://packagist.org/packages/dongrim/laravel-toastr)[ RSS](/packages/dongrim-laravel-toastr/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

Toastr notifications for laravel 5.5+, 6 and 7
==============================================

[](#toastr-notifications-for-laravel-55-6-and-7)

- [Instalation](#instalation)
- [Usage](#usage)
- [Tanks](#tanks)
- [Tutorial video](#tutorial)

Installation
------------

[](#installation)

### 1) Install the Toastr library (front end dependency)

[](#1-install-the-toastr-library-front-end-dependency)

**1.1)** Install [Toastr](http://codeseven.github.io/toastr/) via npm . [Github](https://github.com/CodeSeven/toastr) | [Demo](http://codeseven.github.io/toastr/demo.html)

```
npm install toastr --save-dev

```

**1.2)** Require the js in resources/assets/js/bootstrap.js as `window.toastr = require('toastr');`

```
try {
  window.$ = window.jQuery = require('jquery');

  require('bootstrap');

  window.toastr = require('toastr');

} catch (e) { }

```

**1.3)** Import the sass in resources/assets/sass/app.scss as `@import "~toastr/toastr";` then build via npm `npm run prod`.

```
// Fonts
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700");

// Variables
@import "variables";

// Bootstrap
@import "~bootstrap/scss/bootstrap";

// Toastr
@import "~toastr/toastr";

```

### 2) Install dongrim/laravel-toastr

[](#2-install-dongrimlaravel-toastr)

**2.1)** Run

```
composer require dongrim/laravel-toastr
```

**2.2)** *Optional:* Laravel 5.4 and below
Add `Dongrim\Toastr\ToastrServiceProvider::class` to `providers` in `config/app.php`.
Add `'Toastr' => Dongrim\Toastr\Facades\Toastr::class` to `aliases` in `config/app.php`.

```
// config/app.php

'providers' => [
  // ...
  Dongrim\Toastr\ToastrServiceProvider::class,
],

'aliases' => [
  // ...
  'Toastr' => Dongrim\Toastr\Facades\Toastr::class,
],

```

**2.3)** Run `php artisan vendor:publish --provider="Dongrim\Toastr\ToastrServiceProvider"`to publish the config file in `config/toastr.php`

**2.4)** Add `{!! Toastr::render() !!}` Facade or `{!! toastr()->render() !!}` helper in your main view.

**2.4)** Get all messages `{!! Toastr::messages() !!}` Facade or `{!! toastr()->messages() !!}`

```

    {!! toastr()->render() !!}

```

**2.5)** *Optional:* Modify the publish configuration file locate at `config/toastr.php` to your liking.

```
