smorken / settings
Settings helper for Laravel
v10.1.1
2024-05-22 16:33 UTC
Requires
- php: ^8.1
- illuminate/cache: ^9.0|^10.0|^11.0
- illuminate/console: ^9.0|^10.0|^11.0
- illuminate/routing: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
- smorken/array-cache: ^9.0|^10.0
- smorken/controller: ^1.0
- smorken/service: ^10.0
- smorken/storage: ^10.0
Requires (Dev)
- fakerphp/faker: ^1.15.0
- illuminate/support: ^9.0|^10.0|^11.0
- mockery/mockery: ^1.0
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
- smorken/docker: *
This package is auto-updated.
Last update: 2024-11-22 17:40:23 UTC
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');