fomvasss/laravel-variables
Composer 安装命令:
composer require fomvasss/laravel-variables
包简介
Dynamic management of variables/configs in Laravel app
README 文档
README
Dynamic management of variables/configs in Laravel app: creating and updating they in database, using cache and artisan commands, replace default Laravel configs, etc.
Installation
Run:
composer require fomvasss/laravel-variables
Publish the config, migration:
php artisan vendor:publish --provider="Fomvasss\Variable\VariableServiceProvider"
Run migrate:
php artisan migrate
Usage
Facade Variable
<?php Variable::all(); Variable::get('var_key'); Variable::save('app_name', 'My Var');
Use groupped (multilanguages) variables:
<?php Variable::setGroup('en')->all(); // return Collection! Variable::setGroup('uk')->get('var_key'); Variable::get('var_key', null, 'en'); Variable::get('en|var_key'); Variable::save('uk|var_key', 'UK var');
Use array (json) variables:
Variable::saveArray('links', ['https::google.com', 'https://laravel.com']); // save PHP array Variable::getArray('links'); // return default PHP array!
Use cache variables:
Variable::setGroup('uk')->save('app_name', 'Blog'); Variable::setGroup('uk')->useCache(false)->get('app_name'); //or Variable::get('var_key', null, 'uk', false);
Helpers
variable($name, $default = null, $group = null);
Replace Laravel configs with variables
Set in config/variables.php option config_key_for_vars=vars
Add keys in variable_config array: variable_key => config_key
Console command
variable:all # Show all variables variable:get # Get single variable variable:save # Save single variable variable:cache-clear # Cache clear all variables
Use cache
Set in config/variables.php option cache.time seconds for cache.
Clear variable cache with console:
php artisan variable:cache-clear
or
php artisan cache:forget laravel.variables.cache
Clear variable cache in controller after update var:
Variable::cacheClear(); //or \Cache::forget('laravel.variables.cache');
fomvasss/laravel-variables 适用场景与选型建议
fomvasss/laravel-variables 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.42k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2017 年 12 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「config」 「laravel」 「Settings」 「variable」 「fomvasss」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fomvasss/laravel-variables 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fomvasss/laravel-variables 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fomvasss/laravel-variables 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Persistent settings package for Laravel framework.
A Zend Framework module to quickly and easily set PHP settings.
Settings Card for Laravel Nova.
Extends basic Wordpress features.
Server environment detection based on config array-file
Single and multi-dimensional parameter bag with dot-path access for PHP.
统计信息
- 总下载量: 2.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-13