Download the PHP package jomigomes/laravel-settings without Composer
On this page you can find all versions of the php package jomigomes/laravel-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jomigomes/laravel-settings
More information about jomigomes/laravel-settings
Files in jomigomes/laravel-settings
Package laravel-settings
Short Description A flexible Laravel package for managing scoped, typed settings with a manifesto-based configuration approach
License MIT
Informations about the package laravel-settings
Laravel Settings Package
A flexible Laravel package for managing scoped, typed settings with a manifesto-based configuration approach.
Features
- Scoped Settings: Associate settings with specific models or application segments
- Type Safety: Automatic type casting and validation for various data types
- Manifesto-Based: Single source of truth for settings structure and defaults
- Default Values: Settings are stored in config until changed, preventing database clutter
- Flexible Organization: Support for nested groups and dot notation access
- Model Integration: Easy integration with Eloquent models via the
HasSettingstrait - Events System: Listen to setting lifecycle events (retrieved, created, updated, deleted)
- Facade Support: Clean API with
Settingsfacade - CLI Commands: Manage settings via artisan commands
- Optional Caching: Performance optimization with configurable cache layer
Supported Types
- Integer
- Double
- Boolean
- String
- Array
- Collection (Illuminate\Support\Collection)
- Datetime (Carbon instances)
- Object
Installation
Install the package via Composer:
Publish the configuration file:
Publish and run the migration:
Configuration
The package uses a "manifesto" file (config/settings.php) as the single source of truth for all settings. Define your settings structure here:
Usage
Non-Model Related Settings
Model Related Settings
First, add the HasSettings trait to your model:
Then use settings with your model:
Events
Listen to setting changes in your EventServiceProvider:
Available events:
SettingRetrieved- Fired when a setting is accessedSettingCreated- Fired when a new setting is storedSettingUpdated- Fired when an existing setting changesSettingDeleted- Fired when a setting reverts to default
Artisan Commands
Caching
Enable caching for improved performance in your .env:
Or in config/settings.php:
Documentation
For complete documentation, see the Settings.md file included in this package.
Testing
License
This package is open-sourced software licensed under the MIT license.
Credits
Created by João Gomes
All versions of laravel-settings with dependencies
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0