Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Nova Cache Card Laravel Package

vink/nova-cache-card

Nova Cache Card adds a clean dashboard card to Laravel Nova for monitoring and managing your application cache. View the cache driver, key stats, and configuration at a glance, then clear the cache with a single click. Lightweight, easy to install, and simple to configure.

View on GitHub
Deep Wiki
Context7

Getting Started

First, check whether you can even install it. The last tagged release is February 2019. Open the repo's composer.json before running anything — you should expect constraints around laravel/nova ^1.0|^2.0, laravel/framework 5.7.*|5.8.*, and PHP 7.1–7.3. On anything newer, Composer will either refuse to resolve or install a package whose compiled Vue 2 bundle Nova 4/5 can't mount. Read that file, and package.json, first — they are the entire compatibility story.

composer show vink/nova-cache-card --all   # confirm constraints before committing

Install on a legacy Nova panel.

composer require vink/nova-cache-card
php artisan vendor:publish --provider="Vink\NovaCacheCard\CardServiceProvider"
php artisan nova:publish

Register the card — this is the entire integration surface, one line in app/Providers/NovaServiceProvider.php:

use Vink\NovaCacheCard\CacheCard;

public function cards(Request $request)
{
    return [
        new CacheCard(),
    ];
}

Where to look first, in this order:

  1. src/CacheCard.php — the card class. Note the component name, canSee behavior, and the withMeta() payload (driver/store name shown on the card).
  2. src/CardServiceProvider.php — asset registration and, critically, whether it registers its own route for the clear action. That route's middleware is your security posture.
  3. routes/ (if present) — the flush endpoint, its middleware group, and whether it's behind Nova auth only.
  4. resources/js/components/Card.vue — the button, whether it confirms before firing, and how it calls the endpoint.
  5. webpack.mix.js / resources/js/card.js — the build entry. This is the piece that breaks on modern Nova.

First use case: a QA or support person on staging needs to bust view/config/route cache after a deploy and shouldn't have to file a Slack ping to an engineer. Wire it into the staging dashboard only, hand it to one named role, and track interrupt volume before/after. That delta is the only honest justification for taking on an unmaintained dependency.

Implementation Patterns

Gate the card before it appears in any shared environment. A flush is a privileged action. Nova cards support conditional visibility:

public function cards(Request $request)
{
    return [
        (new CacheCard())->canSee(
            fn ($request) => $request->user()->can('flush-cache')
        ),
    ];
}
// AuthServiceProvider
Gate::define('flush-cache', fn ($user) => $user->hasRole(['admin', 'devops']));

Treat canSee as cosmetic and the route middleware as the real control. If the package's flush endpoint is only guarded by the default nova middleware, any authenticated Nova user can flush. Verify this in CardServiceProvider/routes before you deploy. If it's unprotected, wrap or replace that middleware in a fork — do not rely on the UI hiding the button.

Environment-scoped registration is the most common day-to-day pattern: present in local and staging, absent in production.

public function cards(Request $request)
{
    return [
        ...$this->defaultCards(),
        ...(app()->environment(['local', 'staging']) ? [new CacheCard()] : []),
    ];
}

If you want driver visibility in production with the clear button disabled, that requires a fork — the shipped component is single-action, not configurable.

Prefer artisan cache:clear semantics over raw Cache::flush(). An unqualified flush() on a shared Redis database will also wipe sessions, queued jobs, Horizon metrics, and rate-limit counters. In any fork or wrapper, bind explicitly to the intended store:

Route::middleware(['nova', 'can:flush-cache', 'throttle:5,1'])
    ->post('/nova-vendor/acme/cache-card/clear', function () {
        Cache::store('app-cache')->flush();
        return response()->noContent();
    });

Dedicate a store (separate Redis DB/prefix, or file on staging) so a UI click has a bounded blast radius.

Fork instead of depending, if you need anything beyond the happy path. The package is essentially one PHP class plus one Vue component. Copy it into nova-components/CacheCard/ and extend withMeta() to surface context the Vue side can act on:

public function withMeta()
{
    return [
        'store'       => config('cache.default'),
        'driver'      => config('cache.stores.'.config('cache.default').'.driver'),
        'env'         => app()->environment(),
        'destructive' => app()->environment('production'),
    ];
}

For Nova 4/5, scaffold natively rather than porting the Mix build:

php artisan nova:card acme/cache-card

That gives you Vite, Vue 3, and correct card.js/card.css registration — roughly a day to reach parity and you own the result.

Keep automated clears in the deploy pipeline. The card is for the exception path ("something looks stale, fix it now"). Your deploy script should still run php artisan optimize:clear or targeted view:clear/route:clear. Don't let a manual button become the mechanism.

Test the endpoint like any privileged route:

it('forbids non-admins', function () {
    $this->actingAs(User::factory()->create())
        ->post('/nova-vendor/acme/cache-card/clear')
        ->assertForbidden();
});

it('flushes only the application store', function () {
    Cache::store('app-cache')->put('k', 'v');
    $this->actingAs($admin)->post('/nova-vendor/acme/cache-card/clear');
    $this->assertNull(Cache::store('app-cache')->get('k'));
});

This suite is also your upgrade safety net on the next Nova bump — the only thing that will catch silent breakage.

Gotchas and Tips

It is unmaintained — plan for that on day one. 26 stars, zero dependents, no release since February 2019, no security-response process. Pin the exact version in composer.lock, vendor or fork it into a repo you control, and name an owner. If you're not prepared to own the code, write the card yourself in a day.

Nova 4/5 will not mount the component. Nova 4 moved cards to Vue 3 + Vite and changed scaffolding. Symptom: the card registers, the route works, but the dashboard panel silently renders nothing — or one Vue error blanks the whole dashboard for every user. "It installed" ≠ "it mounts."

Asset pipeline is the usual failure point. On legacy Nova, skipping the publish step leaves an empty card:

php artisan vendor:publish --tag=nova-cache-card-assets
php artisan nova:publish
npm run prod   # only if you've modified the component source

Check the browser Network tab for a 404 on card.js / card.css before debugging anything else.

Grep for deprecated Nova APIs. Search the source for Nova::script(, Nova::style(, and old card registration patterns. Their presence dates the package precisely and tells you what to change first in a port.

No audit trail, and possibly no confirmation. Neither "who clicked it" nor "when" is recorded, and the Vue component may not prompt before firing. Add logging in your wrapper — table stakes for a privileged action and the most-requested addition from stakeholders:

Log::warning('cache.flushed', [
    'user'  => $request->user()->id,
    'store' => 'app-cache',
    'env'   => app()->environment(),
]);

Composer credential drift is a hidden dependency. Nova installs from composer.laravel.com with credentials in auth.json or CI secrets. This card inherits that private-repo requirement in every build, container image, and onboarding path — so an expired Nova license breaks CI for reasons that have nothing to do with the card.

Wrong-store flush is the outage scenario. The two ways it happens: local/staging config leaking into production, or a shared Redis DB holding sessions, queues, and locks. Guard with an environment check in the route handler, not just in the UI, and add throttle:5,1 — plenty for a human-driven action.

Debugging checklist when the button "does nothing":

php artisan route:list | grep -i cache       # is the route registered at all?
php artisan nova:card list                   # legacy Nova; confirms card discovery
tail -f storage/logs/laravel.log             # CSRF 419s and gate denials both land here

Most failures are one of: a missing CSRF token in the card's request, the route sitting behind the wrong middleware group, or canSee hiding the card with no visible indication.

Extension points. The card class is the seam: subclass it, override withMeta() to pass driver/environment to Vue, publish the component if you need a confirmation modal or a disabled-in-production state. Beyond that there is very little to extend — the package is deliberately minimal.

Set the success metric before you ship. "Reduction in cache-related engineering interrupts per sprint, with zero unauthorized flushes." If you can't measure the first half, the card is a novelty; if you can't guarantee the second, it's a liability.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle