Skip to content

CLI Commands

CommandWhat it does
cloudflare-r2-package:installOne-shot installer — deps + migration + assets.
cloudflare_r2:move_existing_filesMigrate existing local product / category media to R2.
cloudflare_r2:remove_media_filesDelete local copies after a successful migration.
cloudflare_r2:export-mediaSync media to R2 (queue-aware).
cloudflare_r2:export-static-contentSync static assets to R2 (queue-aware).

move_existing_files

The main migration command.

bash
php artisan cloudflare_r2:move_existing_files [options]

Options:

FlagWhat it does
--dry-runList files without uploading.
--prefix=public/product/cat-1Limit to one local folder.
--resumeResume from the last checkpoint.
--metadata-onlyWrite mapping rows only — no upload.

remove_media_files

bash
php artisan cloudflare_r2:remove_media_files

Asks for confirmation, then verifies each file exists on R2 before deleting the local copy.

export-media / export-static-content

Both accept --isqueue=1 to dispatch the work to the queue:

bash
php artisan cloudflare_r2:export-media --isqueue=1
php artisan cloudflare_r2:export-static-content --isqueue=1

Released under the MIT License.