PHP code example of zaxbux / backblaze-b2-php

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

    

zaxbux / backblaze-b2-php example snippets




use Zaxbux\BackblazeB2\Client;

$accountId      = '...';
$applicationKey = '...';

$client = new Client([$accountId, $applicationKey]);

// Retrieve an array of Bucket objects on your account.
$buckets = $client->listBuckets();



use Zaxbux\BackblazeB2\Client;

$authCache = new AuthorizationCacheExample;

$client = new Client(new Config($accountId, $applicationKey, [
  'authorizationCache' => $authCache,
]));




use Zaxbux\BackblazeB2\Interfaces\AuthorizationCacheInterface;

class AuthorizationCacheExample implements AuthorizationCacheInterface {
	public function cache($key, $value) {
		$myCache->remember($key, $value, AuthorizationCacheInterface::EXPIRES)
	}

	public function get($key) {
		$myCache->get($key);
	}
}
bash
$ composer