$ show rawilk/laravel-settings
This is a Laravel package that provides a robust, extensible system for storing and retrieving application settings in a database. It supports multiple drivers (database, Eloquent), caching with configurable TTL, encryption of sensitive values, team/multi-tenancy scoping, and contextual settings via a Context object. The architecture is clean: a main Settings service class uses traits for cross-cutting concerns (caching, encryption, teams, context, serializers) and delegates persistence to pluggable drivers. Key generators and value/context serializers are also pluggable via contracts. The package includes a facade, helper function, and model trait for easy integration. It is actively maintained, supports Laravel 12/13 and PHP 8.2-8.5, and has comprehensive test coverage. The code demonstrates good software engineering practices with clear interfaces, separation of concerns, and extensibility.
The LLM identified 2 files worth highlighting for reuse:
Generates human-readable, slugified keys for settings, optionally appending a serialized context string using a configurable context prefix. It implements the KeyGenerator contract and can remove context from a key, enabling bulk operations like all() and flush(). This component is isolated (only depends on ContextSerializer contract and Laravel's Str helper) and can be reused in any project needing a similar key generation strategy with context scoping.
Serializes a Context object into a colon-separated key:value string (e.g., 'model:user::id:1::bool_value:1'). It handles model morph classes and boolean values. This is a clean, isolated implementation of the ContextSerializer contract that can be extracted and reused in other projects requiring a simple, human-readable context serialization format.