config/rest-generic-class.php, which in turn reads environment variables. This design is safe for Laravel’s configuration caching.
Logging Variables
LOG_LEVEL
Sets the minimum log level for the package’s logging channel.Valid values:
emergency, alert, critical, error, warning, notice, info, debugExample:LOG_QUERY
When enabled, logs all query operations to
storage/logs/query.log for debugging.Use case: Debugging API filtering and query generationExample:Filtering Variables
REST_VALIDATE_COLUMNS
Validates that column names in filter conditions exist in the database table before executing queries.Security: Prevents SQL injection and information disclosureExample:
REST_STRICT_COLUMNS
Enforces strict column validation, rejecting requests with invalid column names.When false: Invalid columns are silently ignored
When true: Invalid columns cause validation errorsExample:
Both
REST_VALIDATE_COLUMNS and REST_STRICT_COLUMNS should be true in production for security. Disabling these allows potentially unsafe column names in queries.Cache Variables
REST_CACHE_ENABLED
Master switch for response caching in
BaseService read operations.When enabled: list_all and get_one methods cache responsesExample:REST_CACHE_STORE
Specifies which Laravel cache store to use for caching responses.Valid values: Any Laravel cache driver (
redis, database, file, memcached, dynamodb, array)Example:REST_CACHE_TTL
Default time-to-live (in seconds) for cached responses.Used when: Method-specific TTL is not definedExample:
REST_CACHE_TTL_LIST
Time-to-live (in seconds) for
list_all method responses.Use case: Cache list/index endpoints longer or shorter than single-item readsExample:REST_CACHE_TTL_ONE
Time-to-live (in seconds) for
get_one method responses.Use case: Cache single-item reads with different TTL than listsExample:Validation Cache Variables
REST_VALIDATION_CACHE_ENABLED
Enables caching for database existence validation queries used by the
ValidatesExistenceInDatabase trait.Performance impact: Significantly reduces database load for validationExample:REST_VALIDATION_CACHE_TTL
Time-to-live (in seconds) for cached validation query results.Recommendation: Use longer TTL (1+ hours) since table schemas rarely changeExample:
REST_VALIDATION_CACHE_PREFIX
Prefix for validation cache keys, helping organize and identify validation-related cache entries.Example:
REST_VALIDATION_CONNECTION
Database connection name used for validation queries.Use case: Use a read replica for validation queries to reduce primary database loadExample:
Example Configurations
Development Environment
Production Environment
Staging Environment
Configuration Caching Behavior
This is why the package reads environment variables only from the config file, not directly viaenv() calls in service code. This pattern ensures compatibility with Laravel’s configuration caching.
Related Topics
Cache Strategy
Learn about cache stores, TTL strategies, and invalidation
Validation Config
Configure validation caching behavior