Publishing the Configuration File
Publish the package configuration to your Laravel application:config/rest-generic-class.php in your application, allowing you to customize all package settings.
Publishing the configuration file is optional. The package works with sensible defaults out of the box.
Configuration Structure
The configuration file is organized into four main sections:Logging
Controls how the package logs operations and queries:- Dedicated log channel for package operations
- Query logging for debugging API requests
- Configurable log level via
LOG_LEVELenvironment variable
Filtering
Controls how API requests are filtered and validated:- Safety limits prevent excessive filter complexity
- Column validation ensures only valid columns are queried
- Relation validation requires explicit relation declarations
- Column list caching improves performance
Validation
Controls database existence validation caching:- Validation query caching reduces database load
- Configurable connection for validation queries
- Custom cache prefix for key organization
Cache
Controls response caching for read operations:- Store-agnostic caching (Redis, database, file, etc.)
- Method-specific TTLs for different operation types
- Multi-tenant and locale-aware cache keys
- Automatic invalidation on write operations
Common Configuration Patterns
Development Environment
For local development, enable verbose logging and disable caching:Production Environment
For production, use Redis caching with appropriate TTLs:High-Security Applications
Enable strict validation and disable lenient behaviors:Multi-Tenant Applications
Ensure cache varies by tenant header:Configuration Caching
Laravel’s configuration caching affects how environment variables are read:When configuration is cached, changes to
.env files won’t take effect until you run php artisan config:clear or re-cache with php artisan config:cache.Next Steps
Environment Variables
Complete reference of all environment variables
Cache Strategy
Learn about cache configuration and invalidation
Validation Config
Configure validation caching and rules