pharaonic / laravel-settings
Typed, scoped application settings for Laravel: an Eloquent Setting model for global, named and per-model preferences, with explicit fallback, optional definitions and validation.
13.0.0
2026-11-10 06:19 UTC
Requires
- php: >=8.3 <8.6
- illuminate/console: ^13.0
- illuminate/container: ^13.0
- illuminate/contracts: ^13.0
- illuminate/database: ^13.0
- illuminate/support: ^13.0
- illuminate/validation: ^13.0
Requires (Dev)
- laravel/pint: ^1.20
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- phpstan/phpstan: ^2.1.33
- phpunit/phpunit: ^12.5.8
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Typed settings for Laravel, global, named, or per model, stored through an Eloquent Setting model.
Installation
composer require pharaonic/laravel-settings php artisan migrate
The service provider is registered automatically, and migrate creates the settings table. An application upgrading from 1.x converts its existing table with php artisan settings:migrate-legacy instead (a dry run until --apply). Publish the configuration to change the table, cache, casting policy, or definitions:
php artisan vendor:publish --tag=settings-config
Usage
use Pharaonic\Laravel\Settings\Concerns\HasSettings; class Company extends Model { use HasSettings; }
settings()->setValue('site.name', 'Pharaonic'); // global, type string settings('checkout')->setValue('minimum', 100); // named scope, type integer $company->setSetting('timezone', 'Africa/Cairo'); // model scope, written right away settings()->getValue('site.name'); // 'Pharaonic' settings('checkout')->setValue('minimum', '100'); // SettingTypeMismatchException: stays an integer $theme = settings($branch) ->fallbackTo($company) ->fallbackToGlobal() // then the global scope ->getValue('theme', 'light'); Setting::for($company)->where('type', 'string')->get(); // plain Eloquent: Setting models
Documentation
Full documentation: Laravel Settings Documentation.
Support & Security
See SUPPORT.md and SECURITY.md. Contributions are welcome; see CONTRIBUTING.md.
License
MIT. See LICENSE.
