PHP code example of joredierckx / kirby-s3-sync

1. Go to this page and download the library: Download joredierckx/kirby-s3-sync 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/ */

    

joredierckx / kirby-s3-sync example snippets


return [
    's3' => [
        'active'   => true,                                    // recommended: true in production only, false in local/staging
        'key'      => env('S3_KEY'),                          // never hardcode — see .env below
        'secret'   => env('S3_SECRET'),                        // never hardcode — see .env below
        'bucket'   => 'your-bucket-name',
        'region'   => 'auto',                                  // R2 always uses 'auto'
        'endpoint' => 'https://<account-id>.r2.cloudflarestorage.com',
        'sitename' => 'your-site-slug',                        // must be unique per site sharing a bucket — avoid '.' since it's used as a subdomain
        'cdn'      => 'https://cdn.yourdomain.com',             // optional — omit for non-Cloudflare providers
    ],
];
bash
php scripts/migrate-to-s3.php --dry-run
php scripts/migrate-to-s3.php
bash
php scripts/update-s3-meta.php --dry-run
php scripts/update-s3-meta.php