New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

orus/flash

A simple php and laravel flash alert package.
300
Install
composer require orus/flash
Latest Version:2.0
PHP:>=7.1.0
Laravel:5 – 8
License:MIT
Last Updated:Mar 10, 2021
Links: GitHub  ·  Packagist
Maintainer: orus

A simple php and laravel flash alert package

this package gives you a simple way to manage alerts into your laravel project. It also works with any php project.

Installation

Include the package in your project using composer.

composer require orus/flash

If you're using a version of laravel prior to 5.5 you need you to include te service provider and the alias in your config/app.php.

"providers"  =>  [
  ...
  Orus\Flash\Providers\FlashServiceProvider::class,
],

"aliases"  =>  [
  ...
  "Flash"  =>  Orus\Flash\Facades\Flash::class
]

Usage

Before performing your redirect, you can call the flash() helper function.

Route::post("/login", function() {
  flash("welcome in the matrix");
  
  return redirect("/profile");
}

You can specify the alert type by using the fluent api it offers.

flash(); // Flash object.
flash()->default("message") // A default flash alert
flash()->danger("message") // A danger flash alert
flash()->warning("message") // A warning flash alert
flash()->info("message") // An info flash alert
flash()->success("message") // A success flash alert
flash()->default("message")->title("Default") // Set the alert title
flash()->danger("message")->important() // Set the alert as important
flash()->info("message")->options(["key"] => "value") // Add options to the alert
flash("message")->success(); // Or define your message and set the type.
flash()->info("message")->success("message"); // You can chain multiple alerts.


It also gives you the ability to set multiple flash alerts.

Route::post("/login", function() {
  flash("welcome in the matrix")->default();
  flash("May the code be with you!")->info();
  
  return redirect("/profile");
}

Then you can get a collection of the alerts in your views.

{{ flash()->all() }}

Related Packages

gbuckingham89/laraflash

A package for handling flash messages / notifications in Laravel.

54,676 0
garf/laravel-notifications

Convenient flash notifications

3,983 19
roksta/toast

Toastr notifications in laravel

2,293 3
smodav/flash

Flash messaging package for use with laravel

262 3
jorgejavierleon/laravelpnotify

Laravel 5 implementation for flash messages with Pnotify

17,809 11

Version History

Version Released PHP Laravel License
2.0 >=7.1.0 >=5.4 MIT
v1.3 >=7.1.0 ^5.4|^6.0|^7.0 MIT
1.2 >=7.1.0 ^5.4|^6.0 MIT
1.1 >=5.4.0 ^5.4 MIT
1.0 >=5.4.0 ^5.4 MIT