Download the PHP package scriptoshi/settings without Composer
On this page you can find all versions of the php package scriptoshi/settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scriptoshi/settings
More information about scriptoshi/settings
Files in scriptoshi/settings
Package settings
Short Description Flexible setting manager for scriptoshi based applications
License MIT
Informations about the package settings
Scriptoshi Settings
Scriptoshi Scripts
scriptoshi/settings
is a flexible and powerful settings manager for Laravel Scriptoshi applications. This package allows you to easily manage configuration settings with support for caching, grouping, and dynamic retrieval.
Features
- Easily store and retrieve settings in Scriptoshi Scripts.
- Cache settings for optimized performance.
- Group settings based on categories.
- Supports multiple formats for values (including JSON and booleans).
- Simple facade-based API for accessing settings.
- Laravel 11+ compatible.
Installation
You can install the package via Composer:
Configuration
Once installed, the package will automatically register the service provider.
You can publish the package's configuration file using the command:
Usage
You can use the Setting
facade or the Settings
class directly to interact with your settings.
Retrieving Settings
Get a single setting:
Get a setting with a default value:
Get all settings:
Get settings grouped by their group name:
Get settings by group:
Storing Settings
Store or update a single setting:
Store multiple settings at once:
Caching Settings
Settings are cached by default to reduce database queries. You can manually refresh the cache with:
Facade
The package includes a Setting
facade for easy usage. The following methods are available:
Setting::get($key, $default = null, $fresh = false)
– Retrieve a setting.Setting::set($key, $value)
– Store or update a setting.Setting::all($fresh = false)
– Retrieve all settings.Setting::group($fresh = false)
– Retrieve settings grouped by their category.Setting::for($group)
– Retrieve settings for a specific group.Setting::json($group)
– Retrieve settings for a specific group as JSON.Setting::has($key)
– Check if a setting exists.Setting::remove($key)
– Remove a setting.Setting::refresh()
– Refresh the cached settings.
Testing
Unit Tests
Run the unit tests with PHPUnit:
The package includes unit and feature tests to ensure everything is working as expected.
Development
-
Clone the repository:
-
Install dependencies:
- Run tests:
License
This package is licensed under the MIT License.