Download the PHP package mr-luke/settings-manager without Composer
On this page you can find all versions of the php package mr-luke/settings-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package settings-manager
Settings Manager - Laravel multibag settings Package.
This package provides settings manamgement to your Laravel app with support of multiple setting bags with typed value.
- Getting Started
- Installation
- Configuration
- Usage
- Plans
Getting Started
Setting Manager supported versions:
- Laravel 10
- Laravel 9
- Laravel 8
Installation
To install through composer, simply put the following in your composer.json file and run composer update
Or use the following command
Next, add the service provider to app/config/app.php
Note: Package is auto-discoverable!
Configuration
To use SettingsManager you need to setup your Bags first. Add your own one to the config file bags:
You can setup different database connections or tables by new driver or different json files in:
You can also publish config file via command:
Usage
Facade
You can access to Manager and your Bags using Mrluke\Settings\Facades\Settings.
Type
SettingsManager is a type casted tool that care about it during the whole process.
Example: You can pass string 5.567 to set method for ratio setting (float) and SettingsManager will cast the value to float 5.567 behind the scean.
Whereever you ask for certain key, it will always be correct type. But all begins at the point of registering...
Registering new index
To register new value use:
This method returns given $value casted to given $type.
Accessing index
To get value use:
This method returns $default in case given $key is not present in the Bag. Otherwise $value is casted to registered type.
Setting new value of index
To set new value use:
This method returns $value casted to registered type. If given $key is not present, it will automaticaly call register method with auto-detected type.
This method shoud not be use to register settings in general! Use Eventing to detect all needed settings during development.
Forgeting an index
To forget an index use:
Default Bag vs specified
To access specific Bag use bag accessor method:
Helper
You can access to SettingsManager via helper function:
Events
SettingsManager provides you a list of pre and post action events to help you handle different situations.
Example: You can use Mrluke\Settings\Events\Registered event to prepare full list of production settings.
Namespace Mrluke\Settings\Events:
ForgetingForgotLoadingLoadedRegisteringRegisteredUpdatingUpdated
JSON Structure
SettingsManager provides JSON Driver for configurations that can be share with front-end apps. The structure looks like this:
Plans
- Artisan Commands
- Blade helpers for
boolkeys - Additional option to store
defaultvalue fromget()method
All versions of settings-manager with dependencies
laravel/framework Version ^10.0|^9.0|^8.0
mr-luke/configuration Version ^1.0