mrgoodbytes8667/cache-kernel-pack
A Laravel package that bundles cache kernel utilities for streamlined cache configuration and management. It integrates cache stores with kernel-level handling so you can warm, clear, and organize cached data with less boilerplate.
The name is the tell: -pack plus "recipe" means this is a Composer meta-package. composer require mrgoodbytes8667/cache-kernel-pack pulls in mrgoodbytes8667/cache-kernel (the actual implementation) and, in a Symfony Flex project, applies a recipe that scaffolds config and wires the kernel in.
For a Laravel developer, the key consequence is: Laravel does not run Flex recipes. Installing the pack gives you the dependency but not the auto-configuration. Before writing any code:
vendor/mrgoodbytes8667/cache-kernel/README.md and its src/ — that's where the real API lives. The pack itself is usually just a composer.json with a require.composer.json for extra.laravel.providers / aliases. If present, Laravel auto-discovery will register it and you're ahead; if absent, you'll register the service provider manually.config/ directory in the underlying package to see what should land in config/cache-kernel.php.The realistic first use case: fronting the app with an HTTP cache layer so anonymous GET responses are stored and replayed without invoking controllers — the classic "cache kernel" pattern. Smoke test:
composer require mrgoodbytes8667/cache-kernel-pack
php artisan vendor:publish --provider="Mrgoodbytes8667\\CacheKernel\\CacheKernelServiceProvider"
php artisan tinker # resolve the kernel class to confirm it's bound
Confirm the binding actually exists before assuming the recipe-equivalent happened, because in Laravel it won't.
Since auto-configuration is Flex-only, plan on wiring it yourself.
Kernel wrapping. The value here is a caching kernel class, not middleware. Bind it in a service provider:
$this->app->singleton(CacheKernel::class, function ($app) {
return new CacheKernel(
$app->make(\Illuminate\Contracts\Http\Kernel::class),
$app->make('cache')->store(config('cache-kernel.store')),
);
});
Then either rebind Illuminate\Contracts\Http\Kernel (applies to every request) or wrap it in a route middleware so only chosen routes are cached.
Route-scoped caching. Safer than global. Create a middleware that delegates to the cache kernel for whitelisted routes and leaves POST/PUT/DELETE untouched — the kernel should only short-circuit safe methods.
Store selection. Keep the store behind config. In practice the cache kernel wants something shared (Redis, Memcached, database). file in a multi-node deploy gives you silently inconsistent caches per host.
Invalidation on write. Standard pattern: listen to Model::saved / Model::deleted and purge the matching keys or tags. Design the key scheme (method + URI + query + Vary dimensions) up front; retrofitting tags later is painful.
Don't double-cache. If you already use spatie/laravel-responsecache or Cache::remember in controllers, don't run both. The HTTP cache kernel sits above controller-level caching; stacking them gives you two TTLs and two ways to serve stale data.
composer audit and read the kernel class before production.extra.laravel in both packages; if it's absent, register the provider by hand and publish any config manually.Vary: Cookie/Authorization and mark authenticated responses Cache-Control: private. This is the most common way these kernels cause incidents.Vary handling is subtle. If query, headers, or locale affect the response, they must be in the cache key or the response's Vary header. Test with two Accept-Language values, not one.Age/X-Cache headers before assuming a routing bug. Add a debug identifier header in dev only.Store abstraction, a purge interface, and a key generator — those are usually the seams for custom strategies. If the kernel hardcodes the Cache facade, wrap it rather than fork it.Set-Cookie responses, health checks, or Laravel's built-in status/telescope routes.How can I help you explore Laravel packages today?