Skip to content
/ eflash Public

[DONE] Laracasts flash wrapper that escapes HTML special entities

License

Notifications You must be signed in to change notification settings

HugoJF/eflash

Repository files navigation

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.

About

[DONE] Laracasts flash wrapper that escapes HTML special entities

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages