stratos / laravel-settings
A flexible and extensible settings management package for Laravel applications
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/stratos/laravel-settings
Requires
- php: ^8.3
- illuminate/cache: ^12.0
- illuminate/database: ^12.0
- illuminate/encryption: ^12.0
- illuminate/support: ^12.0
- symfony/yaml: ^7.0
Requires (Dev)
- orchestra/testbench: ^10.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
README
A flexible, enterprise-ready settings management package for Laravel applications. Manage global settings, user preferences, and dynamic configuration with powerful features including encryption, validation, audit trails, and granular permissions.
โจ Key Features
- ๐ Global & User Settings - Application-wide and per-user preferences
- ๐ Encryption - Secure sensitive data with Laravel's encryption
- โ Validation - Per-setting validation rules
- ๐ Audit Trail - Complete change history with rollback
- ๐ Permissions - Role and permission-based access control
- ๐ Multilingual - Translations for labels and descriptions
- โก Caching - Automatic caching with smart invalidation
- ๐ฆ Import/Export - Backup and migration (JSON/YAML)
- ๐ฏ Type Casting - Automatic type detection (string, int, bool, array, json)
- ๐งช Well Tested - 131 Pest tests with full coverage
๐ Requirements
- PHP 8.3 or higher
- Laravel 12.0 or higher
๐ Quick Start
Installation
composer require stratos/laravel-settings
php artisan vendor:publish --tag="settings-migrations"
php artisan migrate
Basic Usage
use Stratos\Settings\Facades\Settings; // Set a value Settings::set('site.name', 'My Application'); // Get a value $name = Settings::get('site.name', 'Default Name'); // Use helper $name = setting('site.name'); // Blade directive <h1>@setting('site.name')</h1>
User Settings
// Set user preference Settings::user()->set('theme', 'dark'); // Get user preference $theme = user_setting('theme', 'light'); // Blade <body class="theme-@userSetting('theme')">
Advanced Features
// Encrypted values Settings::setEncrypted('api.stripe_key', 'sk_live_...'); // With validation Settings::setWithMetadata( key: 'max_users', value: 100, validationRules: ['integer', 'min:1', 'max:1000'] ); // With permissions Settings::setPermissions( key: 'api.credentials', viewType: 'roles', viewPermissions: ['admin', 'developer'], editType: 'roles', editPermissions: ['admin'] ); // View history $history = Settings::getHistory('site.name'); // Rollback Settings::restoreToVersion('site.name', $historyId);
Artisan Commands
# Create setting interactively php artisan settings:create # Set a setting php artisan settings:set site.name "My App" # Get a setting php artisan settings:get site.name # List all settings php artisan settings:list # Export/Import php artisan settings:export settings.json php artisan settings:import settings.json
๐ Documentation
For complete documentation, visit the docs folder:
Getting Started
- Installation - Detailed setup and configuration
- Basic Usage - CRUD operations and helpers
- User Settings - Per-user preferences
Features
- Advanced Features - Validation, encryption, types, caching
- Permissions - Access control system
- Audit & History - Change tracking and rollback
- Import & Export - Backup and migration
- Events & Observers - Event system
Reference
- API Reference - Complete API documentation
- Artisan Commands - CLI reference
- REST API - HTTP endpoints
- Database Schema - Table structure
Guides
- Recipes - Practical examples
- Testing - Testing guide
- Migration Guides - Migrate from other packages
- Troubleshooting - Common issues
๐ฏ Use Cases
Perfect for:
- SaaS Applications - Per-tenant or per-user configuration
- API Credentials - Securely store API keys with encryption
- Feature Flags - Toggle features dynamically
- User Preferences - Theme, language, timezone, notifications
- Email Configuration - Dynamic SMTP settings
- Multi-Tenant Apps - Tenant-specific settings
- Enterprise Apps - Audit compliance and change tracking
๐ Comparison
| Feature | Laravel Settings | Spatie Settings | Config Files |
|---|---|---|---|
| Global Settings | โ | โ | โ |
| User Settings | โ | โ | โ |
| Encryption | โ | โ | โ |
| Validation | โ | โ | โ |
| Permissions | โ | โ | โ |
| Audit Trail | โ | โ | โ |
| Import/Export | โ | โ | โ |
| History/Rollback | โ | โ | โ |
| Caching | โ | โ | โ |
| Dynamic Updates | โ | โ | โ |
๐งช Testing
# Run tests vendor/bin/pest # Run with coverage vendor/bin/pest --coverage
๐ Changelog
See CHANGELOG.md for recent changes.
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
๐ Security
If you discover any security-related issues, please email security@stratosdigital.com instead of using the issue tracker.
๐ License
Laravel Settings is open-sourced software licensed under the MIT license.
๐จโ๐ป Credits
- Author: Mohamed Sabri Ben Chaabane
- Company: Stratos Digital
- Contributors: All Contributors
๐ Support
If you find this package useful, please consider:
- โญ Starring the repository
- ๐ Reporting issues
- ๐ก Suggesting features
- ๐ Improving documentation