swiftmade/statamic-clear-assets
A Statamic addon for clearing cached asset data from the control panel or command line, helping assets and their metadata refresh reliably after changes. It simplifies cache maintenance for editors and developers working with Statamic assets.
composer require swiftmade/statamic-clear-assets — v3.4.0 is the first release advertising Laravel 13.x support, so on a Laravel 12 app you can bump freely, but check composer show swiftmade/statamic-clear-assets afterwards to see the exact illuminate/* and statamic/cms constraints it resolved against. The Laravel 13 bump also raises the practical PHP floor, so verify your runtime before rolling this out to older servers.extra.statamic block in its composer.json; the service provider boots automatically. If you are on a cached-manifest setup, run php artisan package:discover (or a full composer install) after upgrading.php artisan list and grep for asset — the addon's command(s) will show up there. Reading vendor/swiftmade/statamic-clear-assets/src/ (service provider + command class) takes two minutes and tells you exactly which cache directory/handler is being purged.Deployment hook (the canonical use). Wire the command into your deploy script after the new release is symlinked live and after config:cache / route:cache, but before you hit the site with a smoke test:
php artisan migrate --force
php artisan config:cache
php artisan statamic:stache:clear
php artisan <addon-clear-command>
Deployer, Envoyer, Laravel Forge deploy scripts and GitHub Actions all take this the same way — one extra line in the after / post-deploy phase.
Local development. Whenever you add, rename or delete files in an asset container outside the CP (drag-and-drop in Finder, git checkout of a branch that touches public/assets), run the clear command instead of hunting through the CP's per-asset "update" button.
Chain it into an existing "cache bust" command. Most teams already have a app:clear-caches or similar. Compose the addon's command inside it with $this->call(...) so nobody has to remember the addon-specific name:
Artisan::call('cache:clear');
Artisan::call('view:clear');
Artisan::call('<addon-clear-command>');
Scheduled refresh. If assets are pushed in by an external sync (CDN pull, S3 mirror, editorial export), schedule the clear command in routes/console.php / the scheduler at a low frequency rather than clearing on every request.
Pair with Glide. For image-heavy sites the pattern that actually holds up is: clear asset metadata → clear Glide cache → warm. Keep each step as a separate command so a failure in one doesn't silently swallow the others.
php artisan glide:clear; if entries look stale, you want statamic:stache:clear. Reaching for cache:clear first is the classic time-waster here.storage/ is owned by www-data (or vice versa), you get a partial or failed purge. Verify ownership after a fresh provision, and run the command as the same user the web server uses when in doubt.^3.3 there or confirm the constraint still covers your floor — a widened upper bound does not always mean the lower bound is unchanged.-v and check the storage/ path it reports. If nothing appears to change, confirm you are not looking at a CDN/browser cache — the CP is a SPA and will happily serve cached JSON.App\Console\Commands if you need to add logging, Slack notifications or environment guards (e.g. skip on production during business hours). No need to fork the addon for that.How can I help you explore Laravel packages today?