Notyf adapter for PHP flasher

Last updated at 08 May 2022 | Published at 28 November 2020

If you like PHPFlasher please consider giving it a on github or by spreading the word on twitter. Your support allows me to keep this package up-to-date and maintainable. Thank you


Installation

For more information about notyf click here.

For Vanilla PHP:

composer require php-flasher/flasher-notyf

For Laravel:

composer require php-flasher/flasher-notyf-laravel

For Symfony:

composer require php-flasher/flasher-notyf-symfony

Usage

Just instantiate the NotyfFactory and start calling build methods

namespace App\Controller;

use Flasher\Notyf\Prime\NotyfFactory;

class NotifyController
{
    public function flasher(NotyfFactory $flasher)
    {
        // ... 
        $flasher->addSuccess('Data has been saved successfully!');
        
        // ... redirect or render a view here
    }
}    

Fluent Builder methods

All methods in the Usage section are available also for NotyfFactory


duration

Number of miliseconds before hiding the notification. Use 0 for infinite duration.

$flasher->duration(int $duration)

ripple

Whether to show the notification with a ripple effect

$flasher->ripple(bool $ripple)

position

Viewport location where notifications are rendered

$flasher->position(string $position, string $value)

dismissible

Whether to allow users to dismiss the notification with a button

$flasher->dismissible(bool $dismissible)
Younes

PHPFlasher is a project by Younes KHOUBZA.