1. Go to this page and download the library: Download kamilz/b2backblaze 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/ */
kamilz / b2backblaze example snippets
use B2Backblaze\B2Service;
$client = new B2Service($account_id, $application_key);
//Authenticate with server. Anyway, all methods will ensure the authorization.
$client->authorize()
// Returns true if bucket exists
$client->isBucketExist($bucketId)
//Returns the bucket information array.
$client->getBucketById($bucketId)
//Returns the file content and file metadata. Set $metadataOnly to true if you only need metadata information.
$client->get($bucketName, $fileName, $private = false, $metadataOnly = false)
//Return ziped foled of list files by name.
$client->getAllZip($bucketName, array $filesName, $zipFileName, $private = false)
//Inserts file and returns array of file metadata.
$client->insert($bucketId, $file, $fileName)
//Insert large file
$client->insertLarge($bucketId, $filePath, $fileName)
//Delete last file version
$client->delete($bucketName, $fileName, $private = false)
//Rename file in bucket
$client->rename($bucketName, null, $fileName, $targetBucketId, $newFileName, $private = false)
//Returns the list of files in bucket.
$client->all($bucketId)
//Check if the file exists (Internally: We are making a HEAD request, not downloading the file only the response headers, so is less expensive than the query with "existInList". Transactions Class B)
$client->exists($bucketName, $fileName)
//Check if the file exists in a bucket (Internally: Transactions Class C)
$client->existsInList($bucketId, $fileName)
bash
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.