NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

Five maintenance commands cover variants, cleanup, integrity and drafts:

# Regenerate image variants. Optionally filter by model type or ids, limit to named
# variants with --only, and force regeneration of already-generated variants with --force.
php artisan media:regenerate
php artisan media:regenerate "App\Models\User" --ids=1,2,3 --only=thumb,display --force

# Remove orphaned variant files (files in a media's own variants directory it no longer
# records). Conservative: it never touches soft-deleted media, never removes a file any row
# stores as its original, and skips a variants directory the layout shares between media.
php artisan media:clean

# Clear a bucket — delete every media (row + files) in it. Omit the model for global media.
# A model class is mapped through your morph map, so the class name and its alias both work.
php artisan media:clear "App\Models\User" avatar
php artisan media:clear "" brand

# Verify stored media against their checksum baselines; exits non-zero on any failure.
php artisan media:verify
php artisan media:verify "App\Models\User" --ids=1,2,3

# Prune expired, never-bound draft media (rows + files). Schedule this if you use drafts.
php artisan media:prune-drafts
  • media:regenerate — rebuild variants and responsive widths (e.g. after changing a bucket's variant definitions); the same work as MediaLibrary::regenerate().
  • media:clean — remove orphaned variant/width files left behind by definition changes. It never touches soft-deleted media, never removes a file any row stores as its original, and skips a variants directory the layout shares between media.
  • media:clear — delete every media (row + files) in a model or global bucket. The model class is mapped through your morph map, so the class name and its alias both work; unbound drafts are left alone.
  • media:verify — check stored originals against their checksums; useful after disk migrations or to catch bit-rot.
  • media:prune-drafts — the same as MediaLibrary::pruneDrafts(); schedule it if you use drafts.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.