PHPackages                             vironeer/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. vironeer/toastr

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

vironeer/toastr
===============

A Laravel package for displaying toast notifications.

v1.0.2(1y ago)22.1k↓55.6%MITPHPPHP &gt;=8.0

Since May 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/vironeer/toastr)[ Packagist](https://packagist.org/packages/vironeer/toastr)[ RSS](/packages/vironeer-toastr/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Vironeer Toastr for Laravel
===========================

[](#vironeer-toastr-for-laravel)

Vironeer Toastr is a Laravel package that provides an easy way to display toast notifications in your Laravel applications.

[![Vironeer Toastr](https://camo.githubusercontent.com/b9e342d33d7a57881dc463a458cc35d69c67518d702629355a521c16c7d0b04d/68747470733a2f2f63646e2e7669726f6e6565722e636f6d2f6769746875622f6e5261415957395451492e6a7067)](https://camo.githubusercontent.com/b9e342d33d7a57881dc463a458cc35d69c67518d702629355a521c16c7d0b04d/68747470733a2f2f63646e2e7669726f6e6565722e636f6d2f6769746875622f6e5261415957395451492e6a7067)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [Contributing](#contributing)
- [License](#license)

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

[](#installation)

To get started with Vironeer Toastr, follow these steps:

### Prerequisites

[](#prerequisites)

- Laravel 8+
- PHP 8.0 or higher
- Composer

### Install the Package

[](#install-the-package)

You can install the package via Composer:

```
composer require vironeer/toastr
```

### Publish Configuration

[](#publish-configuration)

Publish the package configuration file to customize Toastr settings:

```
php artisan vendor:publish --tag=config --provider="Vironeer\Toastr\ToastrServiceProvider"
```

### Setup Assets

[](#setup-assets)

You can use (CDN) assets and render Toastr notifications :

```
@toastrStyles {{-- use the latest styles version --}}
@toastrStyles(1.0.0) {{-- use a specific styles version --}}

@toastrScripts {{-- use the latest scripts version --}}
@toastrScripts(1.0.0) {{-- use a specific scripts version --}}

@toastrRender
```

Or you can publish the assets (CSS and JS) to your public directory:

```
php artisan vendor:publish --tag=toastr-assets --provider="Vironeer\Toastr\ToastrServiceProvider"
```

And include them in your HTML page:

```

    @toastrRender

```

Usage
-----

[](#usage)

You can display Toastr notifications anywhere in your Laravel application using the provided helper function or facade:

### Using the Helper Function

[](#using-the-helper-function)

```
// Display an info notification
toastr()->info('This is an info message', 'Info');

// Display a success notification
toastr()->success('This is a success message', 'Success');

// Display a warning notification
toastr()->warning('This is a warning message', 'Warning');

// Display an error notification
toastr()->error('This is an error message', 'Error');
```

### Using the Facade

[](#using-the-facade)

You can also use the Toastr facade to display notifications:

```
use Toastr;

// Display an info notification
Toastr::info('This is an info message', 'Info');

// Display a success notification
Toastr::success('This is a success message', 'Success');

// Display a warning notification
Toastr::warning('This is a warning message', 'Warning');

// Display an error notification
Toastr::error('This is an error message', 'Error');
```

Configuration
-------------

[](#configuration)

You can customize Toastr settings by modifying the configuration file located at config/toastr.php. Here you can specify notification options, duration, position, and more.

```
