martynbiz/php-flash-message
Composer 安装命令:
composer require martynbiz/php-flash-message
包简介
Flash messenger that will keep messages until they are "flushed" - current or persistant states.
README 文档
README
Flash messenger that will keep messages until they are "flushed" - current or persistant states.
Installation
Composer
"require-dev": { "martynbiz/php-flash-message": "dev-master" }
Usage
Add message
$flash = new \MartynBiz\FlashMessage\Flash; $flash->addMessage('success', 'You have successfully registered');
Check if message exists by key
$flash->has('success'); // true $flash->has('errors'); // false
Flush messages
This method can be called during the same HTTP request or future request. This means it is useful when redirecting but also forwarding to, for example, another controller action. The contents of the container will be emptied when this method is called once.
$messages = $flash->flushMessages();
Using custom storage
It is possible to use your own storage object, as long as it implements ArrayAccess interface. Below Zend\Storage\Container has been used:
$container = new Zend\Session\Container('mycontainer'); $flash = new Flash($container);
TODO
- create a simple session storage as default
统计信息
- 总下载量: 258
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-21