am-mokhtari/alert-manager
最新稳定版本:v2.0.1
Composer 安装命令:
composer require am-mokhtari/alert-manager
包简介
helper for set and show alerts on website by using sessions
README 文档
README
What's the purpose of this package? 🤔
This package helps you to categorize messages into four types as follows: danger, warning, success and normal.
You can set Flash Messages and retrieve them along with automatic deletion.
How to install 😃
Initially, you need to have the composer installed.
To install this package, follow the command:
composer require am-mokhtari/alert-manager
How to use 😵
The functions in use, follow as below:
- Alert::addNormal(string $message, bool $isFlash)
- Alert::addSuccess(string $message, bool $isFlash)
- Alert::addWarning(string $message, bool $isFlash)
- Alert::addDanger(string $message, bool $isFlash)
This kind of functions is applicable to both regular alerts and flash messages.
This is to add a message to the group of alerts.
If your message is considered as a flash message, you can assign a true value to $isflash.
Regular alerts functions
- Alert::getNormal()
- Alert::getSuccess()
- Alert::getWarning()
- Alert::getDanger()
This kind applies to receive all messages known as the mentioned type. The output would be of type array.
- Alert::all()
This function retrieves all messages as a multidimensional array.
- Alert::pullNormal()
- Alert::pullWarning()
- Alert::pullDanger()
- Alert::pullSuccess()
These functions retrieve messages as the mentioned type and remove them automatically.
The output would be of type array.
- Alert::pullAll()
This function retrieves all messages and removes them automatically.
The output would be multidimensional array.
- Alert::forgetNormalOne(int $key)
- Alert::forgetWarningOne(int $key)
- Alert::forgetDangerOne(int $key)
- Alert::forgetSuccessOne(int $key)
These functions remove the mentioned type message belonging to the $key.
The output would be true.
- Alert::forgetNormal()
- Alert::forgetSuccess()
- Alert::forgetWarning()
- Alert::forgetDanger()
These functions remove the mentioned type messages.
The output would be true.
- Alert::forgetAll()
This function removes all messages.
The output would be true.
The following functions are used for flash messages:
- Alert::pullNormalFlashes()
- Alert::pullSuccessFlashes()
- Alert::pullWarningFlashes()
- Alert::pullDangerFlashes()
These functions retrieve Flash Messages as the mentioned type and delete them automatically.
The output would be of type array.
- Alert::pullAllFlashes()
This function retrieves all Flash Messages and removes them automatically.
The output would be multidimensional array.
Contributing 🤝
To contribute this project, fork the project and share it with me after the changes in a pull request.
Thankful ✨
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-14