PHPackages                             sgflores/schema-settings - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sgflores/schema-settings

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sgflores/schema-settings
========================

A robust Laravel package for managing dynamic application and model-scoped settings with mandatory schema definition, validation, and type safety.

v1.0.2(2mo ago)08MITPHPPHP ^8.1

Since Dec 17Pushed 2mo agoCompare

[ Source](https://github.com/sgflores/schema-settings)[ Packagist](https://packagist.org/packages/sgflores/schema-settings)[ RSS](/packages/sgflores-schema-settings/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (12)Versions (5)Used By (0)

Laravel Schema Settings
=======================

[](#laravel-schema-settings)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/acffb6ae1962992d26e4466782832787e79504a6250f80d732c4283458b9f497/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d626c75652e737667)](https://www.php.net/)[![Laravel Version](https://camo.githubusercontent.com/3cefaa9e1a00e393b49e2ecba1383d856ade657666fc9cd9188496de84558ad0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025374325354531312e3025374325354531322e302d7265642e737667)](https://laravel.com/)

A powerful Laravel package for managing dynamic, schema-driven application settings with validation, caching, encryption, and audit trails.

What is Schema Settings?
------------------------

[](#what-is-schema-settings)

Schema Settings provides a **type-safe, validated approach** to managing application configuration. Define your settings schema once, then get automatic validation, type casting, caching, and audit trails for all setting changes.

### Key Features

[](#key-features)

- ✅ **Schema-Driven** - Define settings with types, defaults, and validation rules
- ✅ **Type Safety** - 11 data types with automatic casting (string, long\_text, integer, boolean, float, array, json, date, time, datetime, enum)
- ✅ **Enhanced Validation** - Immediate type validation with helpful error messages
- ✅ **Validation** - Laravel validation rules enforced on all changes
- ✅ **Dynamic Options** - Lazy-load database-dependent options with callbacks
- ✅ **Caching** - Automatic caching with smart invalidation
- ✅ **Encryption** - Built-in encryption for sensitive data
- ✅ **Audit Trail** - Track all changes with user attribution
- ✅ **Global &amp; Model-Scoped** - Settings for entire app or specific models

Installation
------------

[](#installation)

Install via Composer:

```
composer require sgflores/schema-settings
```

Quick Setup
-----------

[](#quick-setup)

### 1. Publish Configuration &amp; Migrations

[](#1-publish-configuration--migrations)

```
# Publish config file
php artisan vendor:publish --tag=schema-settings-config

# Publish migrations (optional)
php artisan vendor:publish --tag=schema-settings-migrations

# Run migrations
php artisan migrate
```

### 2. Publish Example Schema Classes

[](#2-publish-example-schema-classes)

```
php artisan vendor:publish --tag=schema-settings-configurables
```

This creates example schema classes:

- `app/SchemaSettings/GlobalSettings.php` - Application-wide settings
- `app/SchemaSettings/UserSettings.php` - User-specific settings
- `app/Providers/SchemaSettings/SchemaSettingServiceProvider.php` - Service provider for registering schemas

### 3. Define Your Settings Schema

[](#3-define-your-settings-schema)

Edit `app/Providers/SchemaSettings/GlobalSettings.php`:

```
