Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scottbedard/flash
Super simple flash messaging
https://github.com/scottbedard/flash
Last synced: 18 days ago
JSON representation
Super simple flash messaging
- Host: GitHub
- URL: https://github.com/scottbedard/flash
- Owner: scottbedard
- Created: 2014-10-02T07:19:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-02T08:14:31.000Z (over 10 years ago)
- Last Synced: 2024-12-08T18:49:39.320Z (25 days ago)
- Language: PHP
- Size: 125 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flash Messaging
A Lavavel package for easy flash messaging
https://packagist.org/packages/bedard/flash
##### Adding a flash message
To add a message to the flash que, you have a few options. There are four preset status types, and one for custom statuses.
Here are examples of the four preset status types
```php
Flash::error('On no, something failed!');
Flash::info('Your account has been created!');
Flash::success('Hooray, everything worked!');
Flash::warning('You left a field blank.');
```
You may also add custom status types using the message() method
```php
Flash::message('foo', 'This is a foo message.');
```##### Displaying flash messages
To access your flash messages, look for the session variable named 'flash_messages'. If messages exist, this will be an associative array using the keys 'type' and 'content'.
Here is a quick example of how messages can be accessed and displayed using Laravel's Blade syntax
```html+php
@if($messages = Session::get('flash_messages'))
@foreach($messages as $message)
@endforeach
@endif
```