PHP code example of gyselroth / helper-storage

1. Go to this page and download the library: Download gyselroth/helper-storage 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/ */

    

gyselroth / helper-storage example snippets


 
 use Gyselroth\HelperStorage\S3c;
 
 $awsCredentials = [
      'endpoint'  => 'http://127.0.0.0:9000',  // using custom/local S3-service, e.g. minio 
      'accessKey' => '<YOUR_ACCESSKEY>',
      'secretKEY' => '<YOUR_SECRETKEY>',
      'region'    => '<REGION_CODE>'  
  ];
 
 // Download files from bucket
 S3c::downloadFilesFromBucket(
    array_merge($awsCredentials, ['bucketName' => 'myDownloadsBucket']),
    $pathDownloads,
    $deleteDownloadFilesFromBucket);
 
 // Upload objects to bucket
 S3c::uploadObjectsToBucket(
    array_merge($awsCredentials, ['bucketName' => 'myUploadsBucket']),
    [
        [
            'key'   => 'README.md',
            'body'  => 'hello world!'
        ]
    ]);