Download the PHP package edvinaskrucas/settings without Composer
On this page you can find all versions of the php package edvinaskrucas/settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download edvinaskrucas/settings
More information about edvinaskrucas/settings
Files in edvinaskrucas/settings
Package settings
Short Description Persistent settings package for Laravel framework.
License MIT
Informations about the package settings
Package is looking for maintainers Please contact me if interested.
Persistent Settings for Laravel 5
Persistent settings package for Laravel 5.
- Driver support
- Cache settings via laravel cache
- Encrypt / Decrypt setting values
- Fire events after action
- Override config values
- Helper function
- Settings by context
- Serialize values
Installation
Require this package in your composer.json:
Version matrix
Laravel Version | Package version |
---|---|
>=5.0, <=5.1 | >= 1.0.0, <= 2.0.0 |
5.2 | >= 2.0.0 |
Registering to use it with laravel
Add following lines to
ServiceProvider array
Alias array
Publishing config file
If you want to edit default config file, just publish it to your app folder.
php artisan vendor:publish --provider="Krucas\Settings\Providers\SettingsServiceProvider" --tag="config"
Usage
Configuration
Package comes with several configuration options.
Setting | Description |
---|---|
Setting repository driver. | |
Enable or disable setting cache. | |
Enable or disable setting value encryption. | |
Enable or disable event firing. | |
Config of all repositories which can be used. | |
Key generator class. | |
Context serializer class. | |
Value serializer class. | |
Allows you to override values in Laravel config array. |
Creating table for database driver
To use database driver you have to create table in your database. Package provides default table migration, to create it you need to execute artisan command:
Methods
Set value
Set setting value.
Get value
Get setting value, default value is returned when no value found.
Check value
Determine if setting exists.
Forget value
Forget setting value from repository.
Set context
Setting values may be used in certain context. Context can be set using method .
Context is reset after call of one these methods , , , . Example how to use settings for different contexts.
Helpers
Settings service instance
Resolve settings service instance.
Set value
Set setting value.
Set setting value for a context.
Get value
Get setting value, default value is returned when no value found.
Getting value for a context.
Events
Events gets fired if this is not disabled via config (enabled by default).
settings.checking: $key
Fired before checking if value is present in repository.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$context | null or Context | Setting context. |
settings.has: $key
Fired after checking if value is present in repository.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$status | bool | If setting exists is passed, otherwise |
$context | null or Context | Setting context. |
settings.getting: $key
Fired before retrieving value from repository.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$default | mixed | Default setting value. |
$context | null or Context | Setting context. |
settings.get: $key
Fired after retrieving value from repository.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$value | mixed | Retrieved setting value. |
$default | mixed | Default setting value. |
$context | null or Context | Setting context. |
settings.setting: $key
Fired before setting value to repository.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$value | mixed | Setting value to be set. |
$context | null or Context | Setting context. |
settings.set: $key
Fired after setting value to repository.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$value | mixed | Setting value to be set. |
$context | null or Context | Setting context. |
settings.forgetting: $key
Fired before forgetting value.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$context | null or Context | Setting context. |
settings.forget: $key
Fired after forgetting value.
Parameter | Type | Parameter description |
---|---|---|
$key | string | Setting key. |
$context | null or Context | Setting context. |
All versions of settings with dependencies
illuminate/support Version ^5.2
illuminate/console Version ^5.2
illuminate/database Version ^5.2
illuminate/filesystem Version ^5.2