Download the PHP package jobmetric/laravel-setting without Composer
On this page you can find all versions of the php package jobmetric/laravel-setting. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-setting
[contributors-shield]: https://img.shields.io/github/contributors/jobmetric/laravel-setting.svg?style=for-the-badge
![Contributors][contributors-shield]
Laravel Setting
Build Dynamic Settings. Manage Them Safely.
Laravel Setting lets you define application settings as form-driven classes and store/retrieve them from a database-backed cache. Stop scattering config values across controllers and configs. Use a unified settings layer with validation, caching, discovery, and clear storage keys.
Why Laravel Setting?
Form-Driven Settings
Define each setting form by extending JobMetric\Setting\Contracts\AbstractSetting and returning a JobMetric\Form\FormBuilder that describes fields.
Application-Key Storage
Each setting form produces a stable formName() (application_key). Values are stored per field under that form.
Fast Reads with Cache
Reads are cached under config('setting.cache_key') (default: SETTING). Cache is invalidated whenever settings are stored or forgotten.
Events and Lifecycle Control
Optionally fire StoreSettingEvent and ForgetSettingEvent when storing or deleting settings.
Namespaced Discovery
Register one or more namespaces in SettingNamespaceRegistry. SettingRegistry can discover and validate all AbstractSetting subclasses inside them.
What is a Setting Form?
A setting form is a class that extends AbstractSetting and implements:
application()key()title()description()form()(returnsFormBuilder)
From these, formName() is built as application() . '_' . key() and used as the main storage identifier (form column in the settings table).
What Awaits You?
By adopting Laravel Setting, you can:
- Create setting form classes with
setting:make - Store values safely with
Setting::dispatch()(class-based) orSetting::dispatchByForm()(raw) - Retrieve values with
Setting::get(),Setting::form()and class helpers likeSetting::getFromClass() - Invalidate cache via
setting:clear - Discover all setting forms through
SettingNamespaceRegistryandSettingRegistry - Listen to store/forget events with optional dispatching control
Quick Start
Install Laravel Setting via Composer:
Run migrations:
Create a setting form class:
The command also creates English and Persian translation files and a ready-to-edit FormBuilder example. Consumers should call resolvedForm() when rendering; it dispatches BuildingSettingForm so listeners can add validated fields before the same builder is used for persistence.
Edit the generated class and implement form() by adding the desired fields using FormBuilder.
Settings drivers may also override domiStyles() and domiScripts() to describe page-only assets. The package returns these declarations as metadata and does not depend on Domi itself; a CMS adapter can register them with its document renderer.
Usage
Store settings by form name (raw)
Use dispatchByForm() (or the dispatchSetting() helper). Keys in the object must start with the form prefix ({application_key}_...).
Or via helper:
Store settings by setting class (validated)
Use dispatch() (or dispatchSettingFromClass()) for class-based dispatch with DTO validation via FormBuilderRequest.
Password fields (and fields marked with sensitive()) are encrypted at rest and preserve their stored value when submitted blank. Managed file fields store uploads on the public disk and replace the previous file only after database persistence succeeds.
Read settings
Read from a setting class
Forget settings (delete + cache invalidation)
Clear cache
Documentation
Ready to transform your Laravel applications? Our comprehensive documentation is your gateway to mastering Laravel Setting:
The documentation includes:
- Getting Started - installation and migration steps
- Setting Forms -
AbstractSetting,formName(), andFormBuilder - Setting Service - storing, forgetting, cache invalidation, and retrieval APIs
- Registries -
SettingNamespaceRegistryandSettingRegistrydiscovery rules - Commands -
setting:make,setting:clear - Events -
StoreSettingEventandForgetSettingEvent - Helpers -
dispatchSetting,dispatchSettingFromClass, and read/exists utilities - Testing - package tests and common verification flows
Contributing
Thank you for participating in laravel-setting. A contribution guide can be found here.
License
The laravel-setting is open-sourced software licensed under the MIT license. See License File for more information.
All versions of laravel-setting with dependencies
laravel/framework Version >=9.19
jobmetric/laravel-package-core Version ^1.34
jobmetric/laravel-form Version ^1.6
jobmetric/laravel-custom-field Version ^2.3
jobmetric/laravel-event-system Version ^2.8