digbang / settings
A model for data-driven settings.
Requires
- php: ^8.0.2
- cakephp/chronos: ^2.0
- digbang/utils: ^3.0
- illuminate/support: ^8.0 || ^9.0
- illuminate/view: ^8.0 || ^9.0
- laravel-doctrine/orm: ^1.7
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.6
- laravel-doctrine/fluent: ^1.2
- mockery/mockery: ^1.5
- phpstan/phpstan: ^1.4
- phpstan/phpstan-mockery: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^8.5 || ^9.5
README
(This package uses laravel-doctrine)
Installation
composer require digbang/settings
Then
- Add the service provider to your app.php config file
- Publish or copy the config file
Usage
Change the config file (settings.php) to create, update or edit your settings.
If you want to use an EnumSetting, you need to have a class that extends Digbang\Utils\Enumerables\Enum
Also, the default value for this setting should be an array as follows [YourEnum::class, YourEnum::YourValue]
If you want to use the TimeSetting, note that the expected value is a string with format H:i
All other settings should have a default value of the type the setting requires.
After configuring your settings, use the command settings:sync
to synchronize the config with the database.
You can use the SettingsRepository
to get the values by id, key, etc.