Skip to content

Latest commit

 

History

History
94 lines (55 loc) · 2.18 KB

README.md

File metadata and controls

94 lines (55 loc) · 2.18 KB

Laracasts Flash wrapper for easy HTML escaping

Latest Version on Packagist Total Downloads

This package wraps laracasts/flash in order to help escape HTML special characters with almost the same API.

Facade usage is not implemented since I only use the flash helper!

Why

I got tired of this

$username = e(auth()->user()->username);

flash()->success("Welcome, $username!");

And wanted this

eflash()->success('Welcome, %s!', auth()->user()->username);

Installation

You can install the package via composer:

composer require hugojf/eflash

Usage

Usage should be similar to laracasts/flash and sprintf function.

The first parameter (the template) is NOT escaped in order to allow some HTML in the message.

eflash()->success($format, ...$args);

eflash()->error($format, ...$args);

eflash()->info($format, ...$args);

eflash()->message($format, $level, ...$args);

eflash()->warning($format, ...$args);

Examples

eflash()->success('Welcome %s!', $username);

eflash()->error('Input <strong>%s</strong> is not valid!', $input);

eflash()->info('Server %s was turned off!', $serverName)->important();

eflash()->message('A boring %s', $message)->overlay();

eflash()->warning('Joined team <i>%s</i>!', $teamName)->overlay();

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The GNU GPLv3. Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.