anselmi-dev/flashed
Composer 安装命令:
composer require anselmi-dev/flashed
包简介
A tiny component to flash messages into Laravel session object.
README 文档
README
Flashed is a tiny solution to deal with the flash session in Laravel. Its aim is to keeping simple and driver based messages styling in your views, controllers, repositories, etc.
Getting started
First of all, you have to install the package through Composer running the following command in your terminal:
composer require gocanto/flashed
Once composer is done, add the package service provider in the providers array in config/app.php:
Gocanto\Flashed\FlashedServiceProvider::class,
Second of all, you will have to publish the vendor files shipped within this package. As so,
php artisan vendor:publish --tag=flashed-it
Third of all, you will have to specify the configuration option you wish to have for working with this package. So far, the package was made to work with Twitter bootstrap, but you can modify this to work with any CSS styling you might need.
After running this command, you will be able to see the partial view shipped with the packages, and the configuration file. Being the second one the most important file in order for the Flashed library to work properly.
You will find a good explanation about what each of the configuration options are about. You can take a look at them clicking on here.
How it to implement it in your controllers
You have to import he flash class, as so:
use Gocanto\Flashed\Flash;
Then, you can use its static method to create a new flash message, as so:
Flash::make()->message([ 'title' => 'Hi There!', 'body' => 'this is the body' ]);
The title and body are optional, so you do not have to pass both to the make method. If you do not pass a title, the default one will be used instead.
Also, you will have the ability to create five different flash messages, for examples: 'primary', 'success', 'warning', 'danger' and 'info'. You only need to invoke them like so:
Flash::make('info')->message([ 'title' => 'This is a info message!', 'body' => 'this is the body' ]);
Note: By default, the message type is danger
The view shipped out
The views included with this package can be imported like so,
@include ('vendor.flashedit.messages')
And it was created to work with the default driver which is twitter bootstrap
Contributing
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.
License
The MIT License (MIT). Please see License File for more information.
Don't forget to follow me on twitter!
Thanks!
Gustavo Ocanto. gustavoocanto@gmail.com
anselmi-dev/flashed 适用场景与选型建议
anselmi-dev/flashed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「object」 「session」 「flash」 「laravel」 「messages」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 anselmi-dev/flashed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 anselmi-dev/flashed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 anselmi-dev/flashed 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
Secure session middleware for Slim 3 framework
Runn Me! Value Objects Library
Laravel SDK mapping data in object
Non-I/O blocking PHP SessionHandler implementation using Nette/Caching with DI Extension for Nette framework
CitaNZ's SilverStripe picture object and field for SilverStripe 4
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-12