Download the PHP package litepie/settings without Composer
On this page you can find all versions of the php package litepie/settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download litepie/settings
More information about litepie/settings
Files in litepie/settings
Package settings
Short Description A comprehensive multi-level settings management package for Laravel
License MIT
Homepage https://github.com/litepie/settings
Informations about the package settings
Litepie Settings Package
A comprehensive, enterprise-grade multi-level settings management package for Laravel applications. This package provides a robust and flexible solution for managing application, user, company, and global settings with advanced features like encryption, caching, audit trails, and permissions.
โ Laravel 12 Ready
This package is fully compatible with Laravel 12 and includes:
- PHP 8.2+ Support with modern type declarations
- Updated Dependencies for Laravel 12 compatibility
- Enhanced Type Safety with proper return types and parameter hints
- Modern Laravel Features including constructor property promotion
Requirements
- PHP: ^8.2
- Laravel: ^10.0|^11.0|^12.0
- spatie/laravel-permission: ^6.0
โจ Features
Core Features
- ๐๏ธ Multi-level Settings Hierarchy: Global, company, team, role, and user-specific settings with inheritance
- ๐ง 8 Built-in Data Types: String, integer, float, boolean, array, JSON, encrypted, and file types
- โก Performance Optimized: Built-in Redis/Memcached caching with configurable TTL
- ๐ Security First: Encrypted settings support with Laravel's encryption
- ๐ฅ Multi-tenant Ready: Polymorphic owner relationships for any model
- ๐ Audit Trail: Complete history tracking of all setting changes
- ๐ฏ Grouped Settings: Organize settings into logical groups (appearance, notifications, etc.)
- ๐ Permission System: Granular access control for setting management
Advanced Features
- ๐ค Import/Export: JSON backup and restore with selective group support
- ๐ RESTful API: Complete REST API with authentication and rate limiting
- ๐ฑ Frontend Ready: API resources and validation for frontend integration
- ๐ญ Dependency System: Settings that depend on other settings
- ๐ Validation: Custom validation rules per setting
- ๐ Templates: Pre-defined setting templates for quick setup
- ๐ Real-time Events: Laravel events for setting CRUD operations
- ๐ท๏ธ Metadata Support: Additional data storage for settings
- ๐ Public/Private: Control visibility of settings
๐ฆ Installation
Step 1: Install via Composer
Step 2: Install and Setup
Step 3: Configure (Optional)
The package works out of the box, but you can customize behavior by publishing the config:
๐จ Frontend UI Components
Ready-to-use UI components for managing settings in your frontend applications:
๐ UI Components Documentation - Complete frontend implementation guide
Available for multiple frameworks:
- Vue.js 3 (Composition API) - Modern reactive components
- React 18 (Hooks) - Latest React patterns with custom hooks
- Flutter (Material Design) - Native mobile apps with Material Design
- React Native (Cross-platform) - Mobile apps for iOS and Android
Features include real-time search, group filtering, validation, import/export, and responsive design across all platforms.
๐ Quick Start
Using the Facade
Using the Helper Function
Using the HasSettings Trait
Add the HasSettings
trait to any Eloquent model:
๐ง Advanced Usage
Setting Types and Validation
The package supports 8 built-in data types with automatic casting:
Groups and Organization
Organize settings into logical groups for better management:
Bulk Operations
Efficiently handle multiple settings:
Setting Dependencies
Create settings that depend on other settings:
Caching Control
The package automatically caches settings, but you can control caching behavior:
๐ RESTful API
The package provides a complete REST API for managing settings:
API Endpoints
API Usage Examples
API Configuration
Customize API behavior in config:
โก Artisan Commands
The package includes powerful CLI commands for managing settings:
Installation and Setup
Import/Export Operations
Cache Management
Command Options
Command | Option | Description |
---|---|---|
export |
--file |
Output file path (default: settings.json) |
export |
--owner-type |
Class name of owner model |
export |
--owner-id |
ID of owner instance |
export |
--groups |
Array of group keys to export |
import |
--overwrite |
Overwrite existing settings |
import |
--owner-type |
Import for specific owner type |
import |
--owner-id |
Import for specific owner ID |
โ๏ธ Configuration
Complete Configuration Reference
Publish the config file for full customization:
Key Configuration Options
Environment Variables
๐ Events and Audit Trail
Available Events
The package dispatches events for all setting operations:
Event Usage Examples
Audit Trail and History
The package automatically tracks all changes when audit is enabled:
Audit Configuration
๐ Security and Permissions
Encrypted Settings
Sensitive data is automatically encrypted/decrypted:
Permission System
The package includes a comprehensive permission system:
Public vs Private Settings
Control setting visibility:
Data Validation
Add validation rules to ensure data integrity:
๐ก Real-World Examples
Multi-tenant Application
E-commerce Configuration
SaaS Application Settings
๐๏ธ Architecture and Best Practices
Setting Hierarchy
The package follows a clear hierarchy for setting resolution:
- User-specific settings (highest priority)
- Role-specific settings
- Team/Group settings
- Company/Organization settings
- Global settings (lowest priority)
Performance Optimization
Naming Conventions
Error Handling
๐ง Custom Setting Types
Creating Custom Types
You can create custom setting types for specialized data:
Register the custom type in config:
Use the custom type:
๐จ Troubleshooting
Common Issues
Cache Not Clearing
Settings Not Persisting
Performance Issues
Permission Denied
Debug Mode
Enable debug logging in config:
This will log all setting operations for troubleshooting.
๐ API Reference
Settings Service Methods
Method | Parameters | Return | Description |
---|---|---|---|
get() |
$key, $default, $owner |
mixed |
Get setting value |
set() |
$key, $value, $owner, $options |
bool |
Set setting value |
has() |
$key, $owner |
bool |
Check if setting exists |
forget() |
$key, $owner |
bool |
Delete setting |
all() |
$owner |
Collection |
Get all settings |
getByGroup() |
$groupKey, $owner |
Collection |
Get settings by group |
setMultiple() |
$settings, $owner |
bool |
Set multiple settings |
getMultiple() |
$keys, $owner |
array |
Get multiple settings |
export() |
$owner, $groups |
array |
Export settings |
import() |
$settings, $owner, $overwrite |
bool |
Import settings |
clearCache() |
$key, $owner |
void |
Clear cache |
HasSettings Trait Methods
Method | Parameters | Return | Description |
---|---|---|---|
getSetting() |
$key, $default |
mixed |
Get setting for model |
setSetting() |
$key, $value, $options |
bool |
Set setting for model |
hasSetting() |
$key |
bool |
Check if model has setting |
forgetSetting() |
$key |
bool |
Delete model setting |
getAllSettings() |
- | Collection |
Get all model settings |
getSettingsByGroup() |
$groupKey |
Collection |
Get model settings by group |
setMultipleSettings() |
$settings |
bool |
Set multiple model settings |
๐งช Testing
Unit Testing
The package includes comprehensive tests. Run them with:
Testing in Your Application
Mock Settings in Tests
๐ Migration Guide
From Other Setting Packages
From spatie/laravel-settings
From anlutro/l4-settings
Database Migration
If migrating from another settings package:
๐ค Contributing
We welcome contributions! Please follow these guidelines:
Development Setup
Guidelines
- Write Tests: All new features must include tests
- Follow PSR Standards: Use PSR-12 code style
- Document Changes: Update README and docblocks
- BC Compatibility: Don't break existing APIs without major version bump
Pull Request Process
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Update documentation
- Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
See CHANGELOG.md for complete history.
๐ License
The MIT License (MIT). Please see License File for more information.
๐ Credits
- Renfos Technologies - Package development and maintenance
- Laravel Framework - The amazing framework this package is built for
- All Contributors - Thank you for your contributions and feedback
๐ Support
- Documentation: https://docs.lavalite.org/settings
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
๐ Show Your Support
If this package helped you, please consider:
- โญ Starring the repository
- ๐ Reporting bugs
- ๐ก Requesting features
- ๐ Contributing code
- ๐ข Sharing with others
Made with โค๏ธ by Renfos Technologies
All versions of settings with dependencies
laravel/framework Version ^10.0|^11.0|^12.0
spatie/laravel-permission Version ^6.0