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


PHPFlasher consists of multiple parts, each of which is a separate library. so you can install only the parts you need.

Installation

PHPFlasher can be installed using composer :

composer require php-flasher/flasher

or choose one of the following integration with :

Laravel:

composer require php-flasher/flasher-laravel

Symfony:

composer require php-flasher/flasher-symfony

By default PHPFlasher show its default notification style , but you can install additional adapters as well :


General Usage

If you’re using a framework like Laravel or Symfony, just grab an instance of FlasherInterface from the service container and just before returning a view or redirect, call the addSuccess method for example with the message you want to display.

<?php

namespace App\Controller;

use Flasher\Prime\FlasherInterface;

class BookController
{
    public function save(FlasherInterface $flasher)
    {
        // ...

        $flasher->addSuccess('Book saved successfully');

        flash('Data has been saved successfully!') // laravel helper function

        // ... finally redirect or render the view
    }
}
Younes

PHPFlasher is a project by Younes KHOUBZA.