What this thread does
Do first: replace application-level env() reads with config() keys, then rebuild configuration with php artisan config:cache in the intended deployment environment.
Short answer
As of November 2026, this card targets Laravel 13.x and its release line. Configuration caching deliberately stops loading the environment file during requests and Artisan commands. env() then sees only external system variables (configuration).
Choose / don't choose
- Production: choose cached configuration and
config()reads; don't depend on runtimeenv()reading the environment file. - Diagnosis or local changes: choose
php artisan config:clearto remove a stale snapshot; don't leave production uncached as the permanent repair. - Persistent services: choose a restart after rebuilding; don't expect an already-running process to reload the new application automatically (deployment).
Not for: queue job retry policy; see laravel-queue-timeouts-failed-jobs-safe-retry.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
env('APP_NAME', 'Laravel') | Configuration entry name reads the input; fallback is Laravel | Laravel 13.x application skeleton | Configuration file |
config() | Read file-and-option dot keys; e.g. config('app.timezone') | Laravel 13.x | Accessing values |
php artisan config:cache | Generate the deployment's combined configuration snapshot after environment inputs are ready | Laravel 13.x | Caching |
php artisan config:clear | Purge cached configuration for diagnosis or frequent local changes | Laravel 13.x | Configuration |
php artisan reload | Terminate services through the reload Artisan command; a process monitor must restart them outside Laravel Cloud | Laravel 13.x | Reload |
For example, keep the skeleton's name mapping in the application configuration file and read its app.name key elsewhere; the key follows the documented file/option dot notation. Do not log secret values during diagnosis.
Order of operations
1. Supply the intended environment values in the actual release runtime before generating its snapshot. Building against a different environment freezes the wrong values into that artifact. 2. Run php artisan config:cache as a deployment step (deployment). 3. Reload persistent queue, Reverb or Octane services with php artisan reload; ensure the process monitor replaces exited processes. Laravel Cloud handles this automatically (services). 4. Read the intended configuration key in the same runtime. If it is stale, diagnose the snapshot and rebuild after correcting inputs; if only env() is null, fix the caller rather than repeatedly clearing caches.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
env() returning null variables | Cached mode no longer loads the environment file | Read the mapped configuration key | terremoth's July 21, 2020 report, current rule |
| Old settings remain in a worker (symptom) | Long-running service still uses the previous application | Rebuild the cache, then reload services under a process monitor | Deployment |
Diagnostic: env() returning null variables
Compare the call site and its configuration mapping, then distinguish missing system input from an existing cached value. A null env() result alone is insufficient evidence of a failed cache.
Missing
- Environment ownership and the process monitor are deployment-specific; no secret or universal service-manager command is prescribed.
- The worker symptom has no universal exception text.
- The linked source does not confirm: a null env() value does not mean the configuration snapshot is empty.
Checked
2026-11-12; Laravel 13.x. Sources read: current configuration, deployment, release notes, the application configuration source and terremoth's dated issue. No deployment or application commands were executed.
Started from a post by @Laravel, packaged by the editor. Original post