2017 © Pedro Peláez
 

library laravel-unshitty-flash

Highly opinionated flash message service for Laravel

image

jalle19/laravel-unshitty-flash

Highly opinionated flash message service for Laravel

  • Wednesday, April 5, 2017
  • by Jalle19
  • Repository
  • 1 Watchers
  • 1 Stars
  • 147 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

laravel-unshitty-flash

Build Status Scrutinizer Code Quality Coverage Status, (*1)

Highly opinionated flash message service for Laravel. In contrast to practically all other similar libraries I've seen, this one:, (*2)

  • Supports multiple messages
  • Supports multiple identical messages
  • Supports flashing immediately, i.e. to the current request
  • Let's you configure the session key used
  • Forces you to inject the service, no magic facade
  • Forces you to operate on the Request object itself

Installation

Install the package:, (*3)

composer require jalle19/laravel-unshitty-flash

Register the service provider:, (*4)

'providers' => [
    ...
    Jalle19\Laravel\UnshittyFlash\FlashServiceProvider::class,
    ...
]

Publish the configuration file:, (*5)

php artisan vendor:publish --provider="Jalle19\Laravel\UnshittyFlash\FlashServiceProvider"

Usage

Inject FlashService into the controller you want to create flash messages from, then use it like this:, (*6)

$this->flashService->success($request, 'Some successful message');
$this->flashService->info($request, 'Some informational message');
$this->flashService->warning($request, 'Some warning');
$this->flashService->danger($request, 'Some dangerous message');

If you need to flash a message to the current request, (e.g. from a middleware that displays a permanent message), pass true as the third parameter:, (*7)

$this->flashService->info($request, 'Permanently visible message', true);

If the message levels above are not enough for you, you can use an arbitrary level using the message() method:, (*8)

$this->flashService->message($request, 'Some rant about libraries', 'rant');

To render the flash messages in your views, you can use something like the following snippet:, (*9)

@foreach (session()->get(config('flash.session_key'), []) as $notification)


{!! $notification['message'] !!}
@endforeach

The Versions

05/04 2017

dev-master

9999999-dev

Highly opinionated flash message service for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall

05/04 2017

1.1.0

1.1.0.0

Highly opinionated flash message service for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall

05/04 2017

1.0.2

1.0.2.0

Highly opinionated flash message service for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall

05/04 2017

1.0.1

1.0.1.0

Highly opinionated flash message service for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall

05/04 2017

1.0.0

1.0.0.0

Proper flash notifications for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall