Download the PHP package codegenie-be/laravel-config-cache-guard without Composer

On this page you can find all versions of the php package codegenie-be/laravel-config-cache-guard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-config-cache-guard

Laravel Config Cache Guard

Tests Latest Version on Packagist PHP Laravel

by Codegenie

Laravel Config Cache Guard is a zero-configuration safety and performance layer for Laravel config and route cache. It prevents known-stale deployment cache from being loaded before Laravel boots, automatically creates missing caches when Laravel supports them, and repairs cache after the HTTP response without making visitors wait for Artisan compilation.

Quick start

That is enough for the normal flow. No public/index.php change and no CONFIG_CACHE_GUARD_* variable is required.

Optionally inspect the current state with:

Default behavior

On normal HTTP traffic the package:

Request path

The visitor-facing path deliberately contains detection and protection only:

The pre-bootstrap guard does not run php artisan, does not call proc_open() and does not wait for another request to finish cache compilation.

Deployment source manifest

The active Laravel bootstrap cache directory contains a small file:

It stores only:

It does not store .env values or raw application base paths.

When the manifest is current, the guard avoids repeated RecursiveDirectoryIterator discovery. It checks the already-known source files and directories directly. When a file or source directory changes, the manifest is rebuilt from one shared traversal and both config and route signatures are derived from that same snapshot.

Sources covered

Deployment state includes:

Config signatures also include a one-way runtime identity derived from the application location and OS family. A config cache signed at another runtime path is therefore not assumed to be portable.

The default signature mode uses filesystem metadata. Optional content mode hashes source bytes to detect same-size rewrites that preserve file metadata.

Missing cache creation

If config cache is missing, the package queues config:cache after the current response.

If route cache is missing, the package queues route:cache after the current response.

This is fail-safe:

Laravel config-cache contract

Automatic config caching assumes normal Laravel production conventions: use env() inside configuration files and read values elsewhere through config().

Direct env() access in application code outside config/*.php can behave differently after config:cache is enabled and should be corrected before production caching is relied on.

Route cache behavior

When Laravel uses its default route-cache location, a successful route build is also tracked as:

The pre-bootstrap guard points Laravel at the route cache for the current source signature. If that file does not exist, Laravel falls back to uncached route registration for the current request while repair is queued. An old route cache can remain on disk without being selected.

Explicit custom APP_ROUTES_CACHE paths remain supported when they are available before Composer loads. Stale custom route cache is removed rather than redirected to a package-managed versioned path.

Concurrency

Deferred cache mutation uses one file:

The lock is non-blocking. If 20 requests finish at the same time after a deployment, one worker performs the pending config/route repair and the others return from termination without waiting.

Config and route cache commands are executed sequentially by that one repair owner, avoiding simultaneous deployment-cache mutation by different workers.

Native deployment commands

A deployment pipeline with command access can still build caches explicitly:

Only run route:cache manually when the application's routes support Laravel route caching.

Successful native cache commands are tracked automatically. The package records current deployment signatures and prepares the signature-based route cache where appropriate.

Shared hosting and FTP-only deployments

Destination-side shell access is optional.

For FTP-only or restricted shared hosting:

  1. package or install production Composer dependencies before upload
  2. upload a clean release instead of overlaying an old vendor tree when possible
  3. preserve the production .env
  4. keep Laravel's active bootstrap cache directory writable by PHP
  5. send normal HTTP traffic

Missing cache is generated after a response. Existing stale cache is rejected or bypassed before Laravel uses it. No PHP CLI binary has to be configured for the HTTP fallback.

See deployment recipes for concrete flows.

Status command

The command reports active cache paths, deployment-source manifest state, config/route signatures, pending and failed repair state, recent successful repairs and the shared deferred repair lock.

Use strict mode in deployment automation:

Clear intentionally resolved failure state with:

Optional overrides

The normal package behavior needs no package-specific environment variables. Existing compatibility overrides remain available when configured before Composer loads, including:

Laravel's own optional cache path overrides are also respected:

No override is required for standard Laravel paths.

Files written by the package

Depending on active cache state, the Laravel bootstrap cache directory can contain:

Markers contain safe reason/action metadata and optional one-way source signatures, never .env values or command output.

Requirements

Failure behavior

Situation Behavior
Cache and manifest are current Verify known sources and continue.
Config cache is missing Queue config:cache after the response.
Route cache is missing Queue route:cache after the response.
Route cache cannot be created Continue with uncached routing and remember the source signature for the retry cooldown.
Config source/runtime state changed Remove stale config before Laravel can load it and queue repair.
Route source state changed Point Laravel away from stale routes and queue repair.
Repair lock is held by another request Return immediately; do not duplicate repair.
Sources change during repair Discard the just-built cache and requeue the new signature.
Rebuilt cache signature cannot be stored Remove the untracked cache.
Known-stale cache cannot be removed Stop with a safe 503 rather than load known-stale state.

Development

Install development dependencies and run:

Before a release, also run:

The repository validates Laravel 12 and 13 across their supported PHP matrix and includes Windows, macOS, Linux ARM64 and Alpine portability coverage.

Security and privacy

Report security issues privately. See SECURITY.md.

License

MIT. See LICENSE.md.


All versions of laravel-config-cache-guard with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package codegenie-be/laravel-config-cache-guard contains the following files

Loading the files please wait ...