Skip to content

Commit

Permalink
update readme, licence
Browse files Browse the repository at this point in the history
  • Loading branch information
zaxbux committed Jul 8, 2021
1 parent 3e65372 commit cf6a12b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
File renamed without changes.
38 changes: 17 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
## Backblaze B2 SDK for PHP
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![GitHub](https://img.shields.io/github/license/zaxbux/backblaze-b2-php)][licence] [![Packagist Version](https://img.shields.io/packagist/v/zaxbux/backblaze-b2-php)][packagist]

`b2-sdk-php` is a client library for working with Backblaze's B2 storage service.
`backblaze-b2-php` is a client library for working with the B2 cloud storage service from Backblaze.

## Documentation

[Full documentation of the Backblaze B2 API can be found here.](https://www.backblaze.com/b2/docs/index.html)
[Full documentation of the Backblaze B2 API can be found here.][b2-docs]

Each method is well documented in [`src/client.php`](src/Client.php).

For examples and options that are specific to this library, please see [`docs/`](docs/):

* [Authorization](docs/authorization.md)
* [Downloading](docs/downloading.md)
* [Uploading](docs/uploading.md)
* [Large Files](docs/large_files.md)
* [Buckets](docs/buckets.md)
* [Files](docs/files.md)
* [Keys](docs/keys.md)
Complete documentation for this library does not exist yet, however most methods are already documented in the source code.

## Installation

Installation is via Composer:

```bash
$ composer require zaxbux/b2-sdk-php
$ composer require zaxbux/backblaze-b2-php
```

## Getting Started
Expand All @@ -37,15 +27,15 @@ use Zaxbux\BackblazeB2\Client;
$accountId = '...';
$applicationKey = '...';

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

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

## Authorization Cache

If you want to cache the authorization token to reduce the number of API calls, create a class that implements `Zaxbux\BackblazeB2\AuthorizationCacheInterface`.
If you want to cache the authorization token to reduce the number of API calls, create a class that implements `Zaxbux\BackblazeB2\Interfaces\AuthorizationCacheInterface`.

```php
<?php
Expand All @@ -54,15 +44,17 @@ use Zaxbux\BackblazeB2\Client;

$authCache = new AuthorizationCacheExample;

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

```

### Sample Authorization Cache
```php
<?php

use Zaxbux\BackblazeB2\AuthorizationCacheInterface;
use Zaxbux\BackblazeB2\Interfaces\AuthorizationCacheInterface;

class AuthorizationCacheExample implements AuthorizationCacheInterface {
public function cache($key, $value) {
Expand All @@ -89,6 +81,10 @@ $ vendor/bin/phpunit

Feel free to contribute in any way by reporting an issue, making a suggestion, or submitting a pull request.

## License
## Licence

[MIT][licence]

MIT
[b2-docs]: https://www.backblaze.com/b2/docs/index.html
[licence]: LICENCE.md
[packagist]: https://packagist.org/packages/zaxbux/backblaze-b2-php

0 comments on commit cf6a12b

Please sign in to comment.