inoplate / config
Inoplate配置仓库
v0.0.3
2016-08-14 04:54 UTC
Requires
- illuminate/cache: ^5.3
Requires (Dev)
- benconstable/phpspec-laravel: ~3.0@dev
- laravel/laravel: dev-develop
- phpspec/phpspec: ^3.0
- phpunit/phpunit: ^5.5
- vlucas/phpdotenv: ^2.3
This package is not auto-updated.
Last update: 2024-09-14 19:25:45 UTC
README
Inoplate数据库配置是一个用于从数据库加载配置的PHP包。
示例
$config->has($key) // determine if config has value $config->get($key, $default); // retrieve config value from database $config->all() // retrieve all configuration $config->set($key, $value, $cacheExpiration); // set config value to database and automatically cached. Default cache expiration is 10 minutes
安装
composer install inoplate/config
集成
目前此包仅提供对Laravel ^5.3的集成。要集成,请按照以下步骤操作。
1. Add Inoplate\Config\Laravel\ConfigServiceProvider to your providers configuration.
2. Migrate your database.
3. Change the bootstrappers on your kernel, this file defaultly located in app/Http/Kernel.php and app/Console/Kernel.php.
4. Look at their parent class, we need to overrider the bootstrappers property.
* For Http located at vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
* For Console loacated at vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php
5. Copy and paste the bootstrappers and change 'Illuminate\Foundation\Bootstrap\LoadConfiguration' with 'Inoplate\Config\Laravel\LoadConfiguration'
6. Use as usual
请注意。
1. This package will only persist config via set() call. Call via push(), prepend() and ArrayAccess will not persisted.
2. This package will do necessary cache under the hood
3. Use fully qualified name such as "app.name" and it's value. This package is not supporting nested key such as [app => ['name' => 'My Application', 'site' => 'https://mysites.com']] yet
运行测试
此包使用phpspec进行规范测试和PHPUnit进行集成测试。要运行phpspec,请执行vendor/bin/phpspec run
。要运行Laravel集成测试,请执行vendor/bin/phpunit -c tests/laravel/phpunit.xml
。
贡献
感谢您考虑为此包做出贡献。只需创建一个pull request,并详细说明您的目的。我们可以讨论编码标准、分支策略等。
许可证
本项目采用MIT许可证。