Download the PHP package tamtamchik/simple-flash without Composer
On this page you can find all versions of the php package tamtamchik/simple-flash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tamtamchik/simple-flash
More information about tamtamchik/simple-flash
Files in tamtamchik/simple-flash
Package simple-flash
Short Description Easy, framework agnostic flash notifications for PHP.
License MIT
Homepage https://github.com/tamtamchik/simple-flash
Informations about the package simple-flash
Simple Flash Messages
Easy, framework-agnostic flash notifications for PHP. Inspired by laracasts/flash and plasticbrain/PHP-Flash-Messages. It supports multiple CSS frameworks out of the box:
- Bootstrap (default)
- Foundation
- Bulma
- Materialize
- Tailwind
- Premier
- UIKit
- Semantic UI
- Spectre.css
- Halfmoon
[!NOTE] The documentation below is for version 3.x!
If you are looking the documentation for version 2.x look here.
If you are looking the documentation for version 1.x look here.
Install
Via Composer.
Inside your project make sure to start a session and load Composer autoload to make everything work.
``
Usage
There are 3 ways to use library:
Messages added by calling message($message, $type = 'info')
method. In case of calling a function flash()
you can pass $message, $type
just to function like so: flash('resistance is futile')
.
Because any of creation types return \Tamtamchik\SimpleFlash\Flash
instance, so you can always use chaining to add multiple messages. Shortcuts available for all types of base message types, also you can pass arrays as $message
.
Out of the box library support 4 different types of messages: error
, warning
, info
, success
.
Rendering is simple:
Templates
Using templates you can customize how flash messages will be rendered. Package comes with a set of templates for most popular CSS frameworks:
Shortcuts
You cah pass template name as a second argument to display()
function:
Or you can use descriptive display functions:
Factory
Package comes with a set of templates for most popular CSS frameworks:
This templates can be created using TemplateFactory that comes with package. All templates have aliases defined in Templates.
Creating templates
Template is basically any class that implements TemplateInterface. But to make it easy you can extend BaseTemplate, it already contains most of the functions.
Defining and using this sample class as template:
Will output following:
Interface
Package provides TemplateInterface
for Simple Flash templates.
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Examples
And then just visit http://localhost:8000
Contributing
Please see CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Yuri Tkachenko
- All Contributors
License
The MIT License (MIT). Please see License File for more information.