Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Model Settings Laravel Package

glorand/laravel-model-settings

Laravel Model Settings adds flexible per-model settings to Eloquent models, stored via field, table, or Redis drivers. Define defaults, then get, set, check, or remove settings through a simple API. Supports custom drivers, validation, and easy persistence.

View on GitHub
Deep Wiki
Context7
9.1.0

9.1.0 adds a fourth storage backend: a generic cache driver that stores settings through Laravel's Cache facade, so any store configured in config/cache.php can back them.

✨ New: the cache driver

Set MODEL_SETTINGS_DRIVER=cache, or protected $settingsDriver = 'cache'; on a single model, to store settings in Memcached, DynamoDB, the database, files, or any other store from config/cache.php.

  • MODEL_SETTINGS_CACHE_STORE — named store, empty = the application default
  • MODEL_SETTINGS_CACHE_TTL — lifetime in minutes, empty = forever
  • MODEL_SETTINGS_CACHE_PREFIX — storage key prefix (default c-k-)

Settings are stored forever by default, because for this driver the cache is the only copy of the data rather than a layer in front of a database. The lifetime is refreshed only on write, never on read, so an expiring value will disappear even from a model whose settings are read constantly. A 0, negative or non-numeric TTL throws ModelSettingsException instead of being passed to Cache::put(), which would treat it as a delete.

⚠️ Two things to weigh before choosing this driver: anything that flushes the store (php artisan cache:clear, Cache::flush()) erases the settings of every model using it, and stores that evict under memory pressure can drop them at any time. Use the field or table driver if the settings must survive that.

🔄 Behavior change

The table, redis and cache drivers now require the model to exist in storage, not merely to have a primary key assigned. ModelSettingsException is thrown for an unsaved model even when its key was set manually, so code that used (new User(['id' => 5]))->settings()->all() as a lightweight reference read must load the model instead.

📝 Also documented in this release: the CHANGELOG now carries the previously missing 9.0.1 and 9.0.2 entries.

Full changelog: https://github.com/glorand/laravel-model-settings/compare/9.0.2...9.1.0

9.0.2
9.0.0

V9 is a major refactor that unifies the storage backends into a single, configuration-driven system. This release simplifies the API surface, reduces boilerplate, and provides better extensibility for custom drivers.

🔄 Breaking Changes Migration Required — see MIGRATION_GUIDE_8_to_9.md

Removed HasSettingsField, HasSettingsTable, HasSettingsRedis traits Removed flat settings_* config keys (env vars unchanged) Requires PHP 8.2+ and Laravel 12–13 (dropped 10/11, PHP 8.1) Mutations (set, update, delete, etc.) now persist only overrides; defaults are no longer copied into storage Validation runs against the effective (merged) result, not just persisted data table and redis drivers throw ModelSettingsException when model has no primary key Redis driver deletes the storage key on clear() instead of storing empty array

8.0.3
8.0.2

What's Changed

  • fix: nullable type parameter deprecation on PHP 8.4

New Contributor

@jamesdb made their first contribution in https://github.com/glorand/laravel-model-settings/pull/128

8.0.1

What's Changed

New Contributors

Full Changelog: https://github.com/glorand/laravel-model-settings/compare/8.0.0...8.0.1

6.0.3
6.0.2
6.0.0

Laravel 10 support, and dropped Laravel 9.

5.0.1
5.0.0

What's Changed

Full Changelog: https://github.com/glorand/laravel-model-settings/compare/4.4.1...5.0.0

4.4.1
4.4.0
  • Validation system for settings data
4.3.0
  • Using another method name other than settings()
4.2.2

fix: Parameter type

4.2.1
  • PHP8 support
4.2.0
  • Refactor the work with default settings (flatten arrays)
4.1.0
  • Refactor unit tests
4.0.2
4.0.1
4.0.0
  • Add support for Laravel 8
  • Drop support for Laravel 5.8 and lower
  • Drop support for PHP 7.1 and lower
3.7.0

FIX: HasSettingsField now adheres to $connection override on model

3.6.7
3.6.6

default configs for a table in model_settings.php config file

3.6.5
  • code refactor
  • use Cache facade instead of cache() helper function
3.6.4

GitHub actions

3.6.3

Console test && empty function (#54)

3.6.2

Check settings (exist) (#53)

3.6.1

Fix #50

3.6.0

Add support for Laravel 7 (#49)

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo