Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tony98ms/livewire-notification
Laravel package to launch toast notifications.
https://github.com/tony98ms/livewire-notification
Last synced: 5 days ago
JSON representation
Laravel package to launch toast notifications.
- Host: GitHub
- URL: https://github.com/tony98ms/livewire-notification
- Owner: tony98ms
- License: mit
- Created: 2021-08-22T02:12:06.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T18:38:07.000Z (9 days ago)
- Last Synced: 2024-12-27T19:27:50.652Z (9 days ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel package to launch toast notifications.
[![Latest Stable Version](https://img.shields.io/packagist/v/tonystore/livewire-notification?label=version)](https://packagist.org/packages/tonystore/livewire-notification)
[![Packagist Downloads](https://img.shields.io/packagist/dt/tonystore/livewire-notification)](https://packagist.org/packages/tonystore/livewire-notification)
[![License](https://img.shields.io/packagist/l/tonystore/livewire-notification)](https://packagist.org/packages/tonystore/livewire-notification)
[![PHP Version Require](https://img.shields.io/packagist/dependency-v/tonystore/livewire-notification/php)](https://packagist.org/packages/tonystore/livewire-notification)This package provides assistance when using toast notifications. Using the [iziTOAST](https://izitoast.marcelodolza.com/) package, which allows us to launch elegant and responsive notifications, having the facility to apply a number of configurations that you will find available on their [official site](https://izitoast.marcelodolza.com/) .
## REQUIREMENTS
- [PHP >= 7.2](http://php.net/)
- [Laravel 7|8](https://laravel.com/)
- [Livewire](https://laravel-livewire.com/)
- [iziTOAST](https://izitoast.marcelodolza.com/)## INSTALLATION VIA COMPOSER
### Step 1: Composer
Run this command line in console.
```sh
composer require tonystore/livewire-notification
```
### Step 2: Include componentAdd the [iziTOAST](https://izitoast.marcelodolza.com/) CDN styles and script, and the component containing the script to launch the notifications.
```php
...
@livewireScripts
...
...//INSERT COMPONENT
//OR
@component('livewire-notification::components.toast') @endcomponent
```## Publish Config File
```sh
php artisan vendor:publish --provider="Tonystore\LivewireNotification\LivewireNotificationProvider" --tag="config"
```### Default configuration
```php
//config/livewire-notificationreturn [
'toast' => [
'title' => '', //Defaut Title
'position' => 'topRight', //Defaut Position
'timeout' => 3000, //Display Time
'modal' => null, //Very important, it defines if an event is triggered to close a Bootstrap modal.
],```
## Usage
Now, in any Livewire component, you can launch notifications. To launch a notification you can choose between the different types available:
- success
- info
- error
- warning## Example 1
Launch a simple notification with a personalized message.```php
$this->alert(
'success',
'Example of notification.',
);
```## Example 2
Example of notification with modal event.
```php
$this->alert('info','Example of notification with modal event', [
'modal' => '#hideModal'
]
);```
To use more configurations, you can check the documentation on their [official site](https://izitoast.marcelodolza.com/) .