pixeo / laravel-settings
为 Laravel 应用提供简单的持久化设置包
4.0.0
2022-03-14 14:15 UTC
Requires
- php: ^7.2|^8.0
- illuminate/database: >=5.8
- illuminate/support: >=5.8
Requires (Dev)
- orchestra/testbench: ~3.3.0|~3.4.2|^3.5.0
- phpunit/phpunit: ^7.0
README
在数据库中持久化您的设置
安装
您可以通过 composer 安装此包
composer require pixeo/laravel-settings
包将自动注册自己。
您可以使用以下命令发布配置文件
php artisan vendor:publish --provider="Pixeo\Settings\SettingServiceProvider" --tag="config"
这是发布配置文件的内容
<?php return [ /* * The model that is used to fetch the settings */ 'model' => Pixeo\Settings\Setting::class, /** * The cache key the package will use */ 'cache_key' => 'pixeo.settings', ];
使用方法
\Pixeo\Settings\Setting::create(['key' => 'foo', 'value' => 'bar']); echo setting('foo'); // => bar
测试
composer test
致谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅许可证文件。