Skip to main content
The Rest Generic Class package reads all configuration values from config/rest-generic-class.php, which in turn reads environment variables. This design is safe for Laravel’s configuration caching.

Logging Variables

LOG_LEVEL

string
default:"debug"
Sets the minimum log level for the package’s logging channel.Valid values: emergency, alert, critical, error, warning, notice, info, debugExample:

LOG_QUERY

boolean
default:"false"
When enabled, logs all query operations to storage/logs/query.log for debugging.Use case: Debugging API filtering and query generationExample:
Enabling LOG_QUERY in production can significantly increase log file sizes and I/O overhead. Use only for troubleshooting.

Filtering Variables

REST_VALIDATE_COLUMNS

boolean
default:"true"
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

boolean
default:"true"
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

boolean
default:"false"
Master switch for response caching in BaseService read operations.When enabled: list_all and get_one methods cache responsesExample:

REST_CACHE_STORE

string
default:"env('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

integer
default:"60"
Default time-to-live (in seconds) for cached responses.Used when: Method-specific TTL is not definedExample:

REST_CACHE_TTL_LIST

integer
default:"60"
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

integer
default:"30"
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

boolean
default:"true"
Enables caching for database existence validation queries used by the ValidatesExistenceInDatabase trait.Performance impact: Significantly reduces database load for validationExample:

REST_VALIDATION_CACHE_TTL

integer
default:"3600"
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

string
default:"validation"
Prefix for validation cache keys, helping organize and identify validation-related cache entries.Example:

REST_VALIDATION_CONNECTION

string
default:"db"
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

When you run php artisan config:cache, Laravel caches all configuration values. After caching, changes to .env files are ignored until you clear the cache with php artisan config:clear or re-cache.
This is why the package reads environment variables only from the config file, not directly via env() calls in service code. This pattern ensures compatibility with Laravel’s configuration caching.

Cache Strategy

Learn about cache stores, TTL strategies, and invalidation

Validation Config

Configure validation caching behavior