Download the PHP package bywyd/laravel-qol without Composer
On this page you can find all versions of the php package bywyd/laravel-qol. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-qol
Laravel QoL
Laravel Quality of Life - A collection of helpful traits, utilities, and tools to enhance your Laravel development experience.
Features
Media Management
- HasImages Trait - Easy image management with ordering and tagging
- HasFiles Trait - Generic file upload and management
- HasVideos Trait - Video upload with metadata support
- PhotoImage Model - Complete image model with helper methods
- File Model - Flexible file handling with type detection
- Video Model - Video model with duration, resolution, and thumbnails
Model Enhancements
- HasHistory Trait - Automatic model change tracking
- HasRoles Trait - Complete role and permission system for users
- HasIntegrations Trait - Manage user integrations with OAuth, API keys, and credentials
- HasSettings Trait - Universal settings system (app-wide, per-user, per-model)
- HasUuid Trait - Automatic UUID generation for models
- HasSlug Trait - Automatic slug generation from any field
- HasStatus Trait - Status management with active/inactive scopes
- Sortable Trait - Easy ordering/sorting functionality
- Cacheable Trait - Built-in model-level caching
- Searchable Trait - Simple and full-text search capabilities
Authorization
- Role Model - Hierarchical role system with levels
- Permission Model - Granular permission control
- Middleware - Route protection with role, permission, or both
- Blade Directives - Template-level authorization checks
- Gates Integration - Automatic Laravel Gate registration
Installation
Install via Composer:
Configuration
Publish the configuration file (optional):
Publish the migrations:
Usage
HasHistory Trait
Track all changes made to your models automatically:
HasImages Trait
Manage images for your models with ease:
HasFiles Trait
Upload and manage any type of file:
HasVideos Trait
Manage video uploads with metadata:
HasUuid Trait
Automatically generate UUIDs for your models:
HasSlug Trait
Automatic slug generation from any field:
HasStatus Trait
Manage model status with convenient methods:
Sortable Trait
Add ordering functionality to your models:
Cacheable Trait
Built-in model caching:
Searchable Trait
Add search functionality:
HasRoles Trait
Complete role and permission system for User models:
Role Model
Manage roles with hierarchical levels:
Permission Model
Create and manage permissions:
Route Protection with Middleware
Protect routes using middleware:
Blade Directives
Use in your Blade templates:
Laravel Gates
Permissions are automatically registered as Gates:
Policy Integration
Use with Laravel Policies:
Creating a Complete Authorization System
HasIntegrations Trait
Manage user integrations with third-party services:
UserIntegration Model
Direct model usage:
Common Integration Examples
Security Features
All sensitive data is automatically encrypted:
- Access tokens
- Refresh tokens
- API keys
- API secrets
- Custom credentials
The trait uses Laravel's built-in encryption, ensuring data is secure at rest.
Middleware
The package includes 10 production-ready middleware:
SetLocale Middleware
Automatically sets application locale based on multiple sources (priority order):
RestrictAccess Middleware
Maintenance mode with granular access control:
ForceJsonResponse Middleware
Force JSON responses for API applications:
LogRequestResponse Middleware
Log all HTTP requests and responses:
SecurityHeaders Middleware
Add security headers automatically:
RateLimitByUser Middleware
Rate limiting per user or IP:
ConvertEmptyStringsToNull Middleware
Convert empty strings to null in requests:
TrimStrings Middleware
Automatically trim string inputs:
ApiVersioning Middleware
API versioning support:
CorsMiddleware
Advanced CORS handling:
Universal Settings System
Flexible settings system supporting app-wide, per-user, and per-model settings.
App-Wide Settings
Use the Settings facade for application-level settings:
Per-User Settings
Add the HasSettings trait to your User model:
Per-Model Settings
Add the HasSettings trait to any model:
Settings Features
Type Support:
- String
- Integer
- Float
- Boolean
- Array
- JSON
Automatic Caching:
- Settings are cached automatically
- Cache cleared on update/delete
- Configurable TTL
Organization:
- Group settings logically
- Isolate by model instance
- Public vs private settings
Metadata:
- Store additional info about settings
- Descriptions, editability flags, etc.
Real-World Examples
CommonScopes Trait
Add powerful query scopes to your models:
Available scopes: active(), inactive(), recent(), older(), today(), thisWeek(), thisMonth(), thisYear(), betweenDates(), latest(), oldest(), whereIds(), whereNotIds(), whereLike(), whereEmpty(), whereNotEmpty(), random(), popular(), featured(), published(), draft(), smartPaginate()
ApiResponse Trait
Standardized API responses for controllers:
Available methods: success(), error(), created(), updated(), deleted(), notFound(), unauthorized(), forbidden(), validationError(), serverError(), paginated(), noContent()
Request Macros
Enhanced request handling:
Collection Macros
Extended collection functionality:
Validation Rules
Custom validation rules:
Helper Functions
Global utility functions:
Database Utilities
QueryLogger
Log and analyze database queries:
ModelUtility
Useful model introspection methods:
Usage Examples
Example 1: API Controller with All Features
Example 2: Using Utilities for Performance Monitoring
Example 3: Model with All Traits
Available Traits
Media Traits
- HasImages - Image management with ordering, tagging, and URLs
- HasFiles - Generic file management with type detection
- HasVideos - Video management with metadata and thumbnails
Model Enhancement Traits
- HasHistory - Automatic change tracking with old/new values
- HasRoles - Complete role & permission system with middleware and Blade directives
- HasIntegrations - OAuth, API keys, and third-party service credentials
- HasUuid - Auto-generate UUIDs on model creation
- HasSlug - Auto-generate unique slugs from any field
- HasStatus - Active/inactive status management
- Sortable - Ordering and reordering functionality
- Cacheable - Model-level caching with auto-invalidation
- Searchable - Simple and full-text search
Authorization System
- Role Model - Hierarchical roles with level-based access
- Permission Model - Granular permission control with groups
- Route Middleware -
role,permission,role_or_permission - Blade Directives -
@role,@permission,@hasanyrole, etc. - Laravel Gates - Auto-registered from permissions
- Super Admin - Wildcard permission support
Requirements
- PHP 8.1 or higher
- Laravel 10.0 or higher
License
The MIT License (MIT). Please see License File for more information.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.