PHP code example of xerxes / s3-move

1. Go to this page and download the library: Download xerxes/s3-move library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xerxes / s3-move example snippets


return [
    // Paths to scan for files
    'local_paths' => [
        storage_path('app/public'),
        public_path('img'),
        public_path('images'),
    ],

    // File extensions to migrate
    'extensions' => [
        'jpg', 'jpeg', 'png', 'gif', 'webp', 'svg',
        'pdf', 'mp4', 'mov', 'doc', 'docx', 'zip',
    ],

    // S3 bucket name
    'aws_bucket' => env('AWS_BUCKET'),

    // S3 path prefix
    'aws_bucket_path' => env('AWS_BUCKET_PATH', '/'),
];

// In your EventServiceProvider
protected $listen = [
    \Xerxes\S3Move\Events\S3MigrationCompleted::class => [
        YourListener::class,
    ],
];

// YourListener.php
public function handle(S3MigrationCompleted $event)
{
    // $event->migratedFiles contains the collection of migrated files
    foreach ($event->migratedFiles as $file) {
        // Update database records, clean up, etc.
    }
}
bash
php artisan vendor:publish --tag=s3move-config
bash
php artisan s3:move
bash
php artisan s3:move --force
bash
php artisan s3:move --overwrite
bash
php artisan s3:move --delete