microweber-packages / microweber-app-bootstrap-cache
Versioned bootstrap cache paths for Laravel applications. Resolves cache file paths based on Laravel version and an optional application version, ensuring stale cached files are never loaded after upgrades.
Package info
github.com/microweber-packages/microweber-app-bootstrap-cache
pkg:composer/microweber-packages/microweber-app-bootstrap-cache
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
- laravel/framework: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
- microweber-packages/app-bootstrap-cache: *
This package is auto-updated.
Last update: 2026-11-09 13:59:03 UTC
README
Versioned bootstrap cache paths for Laravel applications.
Problem
When you upgrade Laravel or your application, the cached bootstrap files
(services.php, packages.php, config.php, etc.) may become stale and
cause errors. This package solves that by including the Laravel version (and
optionally your application version) in the cache file names.
Installation
composer require microweber-packages/microweber-app-bootstrap-cache
Usage
Use the HasVersionedBootstrapCache trait in your Application class:
<?php namespace App; use Illuminate\Foundation\Application; use MicroweberPackages\AppBootstrapCache\HasVersionedBootstrapCache; class MyApplication extends Application { use HasVersionedBootstrapCache; // Optional: define a version constant for your app const APP_VERSION = '2.0.0'; }
The trait overrides getCachedServicesPath(), getCachedPackagesPath(),
getCachedConfigPath(), getCachedRoutesPath(), and getCachedEventsPath()
to produce versioned file names like:
bootstrap/cache/cache_11_54_0_2_0_0_services.php
bootstrap/cache/cache_11_54_0_2_0_0_config.php
Without an Application Subclass
If you don't have a custom Application class, you can use the
VersionedBootstrapCacheHelper to compute versioned paths directly:
use MicroweberPackages\AppBootstrapCache\VersionedBootstrapCacheHelper; $helper = new VersionedBootstrapCacheHelper('11.54.0', '2.0.0'); $helper->getVersionPrefix(); // "11_54_0_2_0_0" $helper->getCacheFileName('services'); // "cache_11_54_0_2_0_0_services.php"
License
MIT
Authors
Part of Microweber, built by:
- Peter Ivanov
- Bozhidar Slaveykov