Pnotify 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 Pnotify click here.

For Vanilla PHP:

composer require php-flasher/flasher-pnotify

For Laravel:

composer require php-flasher/flasher-pnotify-laravel

For Symfony:

composer require php-flasher/flasher-pnotify-symfony

Usage

Just instantiate the PnotifyFactory and start calling build methods

namespace App\Controller;

use Flasher\Pnotify\Prime\PnotifyFactory;

class NotifyController
{
    public function flasher(PnotifyFactory $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 PnotifyFactory


title

The notice’s title.

$flasher->title(bool|string $title)

titleEscape

Whether to escape the content of the title. (Not allow HTML.)

$flasher->titleEscape(bool $titleEscape = true)

text

The notice’s text.

$flasher->text(string $text)

textEscape

Whether to escape the content of the text. (Not allow HTML.)

$flasher->textEscape(bool $textEscape = true)

styling

What styling classes to use. (Can be either “brighttheme”, “bootstrap3”, “fontawesome”, or a custom style object. See the source in the end of pnotify.js for the properties in a style object.)

$flasher->styling(string $styling)

addClass

Additional classes to be added to the notice. (For custom styling.)

$flasher->addClass(string $addClass)

cornerClass

Class to be added to the notice for corner styling.

$flasher->cornerClass(string $cornerClass)

autoDisplay

Display the notice when it is created. Turn this off to add notifications to the history without displaying them.

$flasher->autoDisplay(bool $autoDisplay = true)

width

Width of the notice.

$flasher->width(int $width)

minHeight

Minimum height of the notice. It will expand to fit content.

$flasher->minHeight(int $minHeight)

icon

Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your own icon class.

$flasher->icon(bool $icon = true)

animation

The animation to use when displaying and hiding the notice. “none” and “fade” are supported through CSS. Others are supported through the Animate module and Animate.css.

$flasher->animation(string $animation)

animateSpeed

Speed at which the notice animates in and out. “slow”, “normal”, or “fast”. Respectively, 400ms, 250ms, 100ms.

$flasher->animateSpeed(string $animateSpeed)

shadow

Display a drop shadow.

$flasher->shadow(bool $shadow = true)

hide

After a delay, remove the notice.

$flasher->hide(bool $hide = true)

timer

Delay in milliseconds before the notice is removed.

$flasher->timer(int $timer)

mouseReset

Reset the hide timer if the mouse moves over the notice.

$flasher->mouseReset(bool $mouseReset = true)

remove

Remove the notice’s elements from the DOM after it is removed.

$flasher->remove(bool $remove = true)

insertBrs

Change new lines to br tags.

$flasher->insertBrs(bool $insertBrs = true)

destroy

Whether to remove the notice from the global array when it is closed.

$flasher->destroy(bool $destroy = true)

desktop

Desktop Module

$flasher->desktop(string $desktop, mixed $value)

buttons

Buttons Module

$flasher->buttons(string $buttons, mixed $value)

nonblock

NonBlock Module

$flasher->nonblock(string $nonblock, mixed $value)

mobile

Mobile Module

$flasher->mobile(string $mobile, mixed $value)

animate

Animate Module

$flasher->animate(string $animate, mixed $value)

confirm

Confirm Module

$flasher->confirm(string $confirm, mixed $value)

history

History Module

$flasher->history(string $history, mixed $value) 
Younes

PHPFlasher is a project by Younes KHOUBZA.