Search by

microweber-packages / microweber-app-bootstrap-cache

boksiora

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

Homepage

pkg:composer/microweber-packages/microweber-app-bootstrap-cache

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-03 11:17 UTC

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