PHP code example of gliterd / backblaze-b2

1. Go to this page and download the library: Download gliterd/backblaze-b2 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/ */

    

gliterd / backblaze-b2 example snippets

 php
$updatedBucket = $client->updateBucket([
    'BucketId' => $bucket->getId(),
    'BucketType' => Bucket::TYPE_PUBLIC
]);
 php
$buckets = $client->listBuckets();
 php
$client->deleteBucket([
    'BucketId' => 'YOUR_BUCKET_ID'
]);
 php
$copyOfFile = $client->copy([
    'BucketName' => $bucketName,
    'FileName'   => $path,
    'SaveAs'     => $newPath,

    // Can also supply BucketId instead of BucketName
    // Optional are DestinationBucketName or DestinationBucketId
]);
 php
$fileDelete = $client->deleteFile([
    'FileId' => $file->getId()

    // Can also identify the file via bucket and path:
    // 'BucketName' => 'my-special-bucket',
    // 'FileName' => 'path/to/file'
]);
 php
$fileList = $client->listFiles([
    'BucketId' => 'YOUR_BUCKET_ID'
]);