calen/persist
Composer 安装命令:
composer require calen/persist
包简介
Application Preferences
README 文档
README
Persist is a library intended to manage application settings. The settings persists every request and handle multiple drivers (currently file and database).
Installation
Add the repository as a dependency by running:
composer require calen/persist
Then add the provider to the provider list in app.php:
....
App\Providers\RouteServiceProvider::class,
Calen\Persist\PersistServiceProvider::class,
You can then publish the packages configuration file by running
php artisan vendor:publish
which will create the file persist.php in the config directory.
The configuration is pretty simple:
- the driver to use (database or file)
- the file path in case of file driver
- the table name in case of database driver
The publish will also create a migration file if you need to use the database driver.
Usage
The settings are stored as a JSON object in either the file or the database.
Persist comes with a Facade. You can add this facade to the facades list in app.php:
'Persist' => Calen\Persist\Facade\Persist::class,
To publish a key:
Persist::persist('name.subname.subsubname', 'value', true);.
The first parameter is the key to add. As the storage is JSON, the subname and subsubname are the nest in the JSON object. If the names and subnames do not exist, they will be created. The second parameter is the value to set to the key. The third parameter is optional and specifies if the save should be applied. default is false
To get a key, use:
Persist::get('name.subname.subsubname');
with the path in the object. If the path is not a leaf in the tree, it will return the tree corresponding as an array.
To forget a key, use:
Persist:forget('name.subname.subsubname', true);
which will simple remove the key.
Packagist
My packagist repo is available here : https://packagist.org/packages/calen/persist
calen/persist 适用场景与选型建议
calen/persist 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 10 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 calen/persist 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 calen/persist 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-05