hexbit/php-flash
Composer 安装命令:
composer require hexbit/php-flash
包简介
Its a session based redirector with flash messages for php.
README 文档
README
Its a session based redirector with flash messages for php. you can set flash messages between redirects and you can get your messages only once with php $_SESSION super global array.
Installation
Use the package manager composer to install php flash.
composer require hexbit/php-flash
Usage
use Hexbit\Flash\Flash; // first initialize it: Flash::init(); // build a new instance of flash $flash = new Flash(); // simple usage and redirect back! $flash->redirectBy('contact') ->message('failed', 'It seems your email is not valid!') ->redirectBack(); // redirect to specific location $flash->redirectBy('contact') ->redirectLocation("https://somewhere/") ->withStatus(302) ->message('failed', 'It seems your email is not valid!') ->redirect(); // redirect to specific location and then redirect again after 5 seconds! $flash->redirectLocation("https://somwhere/") ->message('failed', 'It seems your email is not valid!') ->secondRedirect(5, "https://somewhereelse/") ->redirect();
Now your flash messages will be available just once (after redirection) in the superGlobal $_SESSION array.
And obviously, there will be no messages for the next times and will be cleared.
if (isset($_SESSION['failed']) { // show your error message for example }
Contributing
Pull requests are always welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make %sure% to update tests as appropriate.
License
统计信息
- 总下载量: 71
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-04