smorken/settings
最新稳定版本:v11.0.2
Composer 安装命令:
composer require smorken/settings
包简介
Settings helper for Laravel
README 文档
README
License
This software is open-sourced software licensed under the MIT license
The Laravel framework is open-sourced software licensed under the MIT license
Requirements
- PHP 7.2+
- Composer
Installation
- add to your Laravel app composer.json
"require": {
"smorken/settings": "^6.0"
}
composer update
Service Provider should auto register itself. If not:
- add service provider to
config/app.php
'providers' => [
...
\Smorken\Settings\ServiceProvider::class,
- publish any needed files
$ php artisan vendor:publish --provider="Smorken\Settings\ServiceProvider" --tag=config #view and config available
- run the migrations
$ php artisan migrate
Use
app(Smorken\Settings\Contracts\Storage\Setting::class) provides an instance of Smorken\Settings\Contracts\Storage\Setting
setting() is a shortcut for the same
Smorken\Settings\Facades\Setting::class is a facade accessor
Get a setting value:
$s = app(Smorken\Settings\Contracts\Storage\Setting::class);
$value = $s->get('foo.key');
$value = setting('foo.key', 'default_value');
$value = \Smorken\Settings\Facades\Setting::get('foo.key', 'default_value');
Set a settings value (shortcut):
$s = app(Smorken\Settings\Contracts\Storage\Setting::class);
$s->set('foo.key', 'value');
setting()->set('foo.key', 'value');
\Smorken\Settings\Facades\Setting::set('foo.key', 'value');
统计信息
- 总下载量: 1.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-12-20