PHPackages                             obregonco/backblaze-b2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. obregonco/backblaze-b2

ActiveLibrary[File &amp; Storage](/categories/file-storage)

obregonco/backblaze-b2
======================

An SDK for working with B2 cloud storage.

1.1.0(5y ago)2734.0k↓12.2%13[5 issues](https://github.com/obregonco/backblaze-b2/issues)LGPL-3.0-or-laterPHPPHP &gt;=7.0.0CI failing

Since Oct 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/obregonco/backblaze-b2)[ Packagist](https://packagist.org/packages/obregonco/backblaze-b2)[ Docs](https://github.com/obregonco/backblaze-b2)[ RSS](/packages/obregonco-backblaze-b2/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (5)Versions (9)Used By (0)

Backblaze B2 SDK for PHP
------------------------

[](#backblaze-b2-sdk-for-php)

[![Software License](https://camo.githubusercontent.com/2bc95db9d4d6b319fe40fe1a46431a18f9684b30d516775115c5d0df6aa3e9b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4c47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Latest Version](https://camo.githubusercontent.com/57bab4bb1f1ca38c475fe47c268d2e417c1cc9d304fc1743bb88f3f27a6ec20c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6f627265676f6e636f2f6261636b626c617a652d62322e7376673f7374796c653d666c61742d737175617265)](https://github.com/obregonco/backblaze-b2/releases)[![Build Status](https://camo.githubusercontent.com/6679bde20812f797426b80730c34ea4af5dc256d2eeadbcfe13ca66ecdb360e3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6f627265676f6e636f2f6261636b626c617a652d62322e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/obregonco/backblaze-b2)

`backblaze-b2` is a client library for working with Backblaze's B2 storage service. It aims to make using the service as easy as possible by exposing a clear API and taking influence from other SDKs that you may be familiar with.

This package will **cache authorization request** for 1 hour so that you won't receive API Limit from B2.

This version works with both master key and application key, and version 2 (look below).

Example
-------

[](#example)

This is just a short example, full examples to come on the wiki.

```
use obregonco\B2\Client;
use obregonco\B2\Bucket;

$client = new Client('accountId', [
	'keyId' => 'your-key-id', // optional if you want to use master key (account Id)
	'applicationKey' => 'your-application-key',
]);
$client->version = 2; // By default will use version 1
$client->domainAliases = [ // When you want to use your own domains (using CNAME)
		'f0001.backblazeb2.com' => 'alias01.mydomain.com',
	];
$client->largeFileLimit = 3000000000; // Lower limit for using large files upload support. Default: 3GB

// Returns a Bucket object.
$bucket = $client->createBucket([
    'BucketName' => 'my-special-bucket',
    'BucketType' => Bucket::TYPE_PRIVATE // or TYPE_PUBLIC
]);

// Change the bucket to private. Also returns a Bucket object.
$updatedBucket = $client->updateBucket([
    'BucketId' => $bucket->getId(),
    'BucketType' => Bucket::TYPE_PUBLIC
]);

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

// Delete a bucket.
$client->deleteBucket([
    'BucketId' => '4c2b957661da9c825f465e1b'
]);

// Upload a file to a bucket. Returns a File object.
$file = $client->upload([
    'BucketName' => 'my-special-bucket',
    'FileName' => 'path/to/upload/to',
    'Body' => 'I am the file content'

    // The file content can also be provided via a resource.
    // 'Body' => fopen('/path/to/input', 'r')
]);

// Download a file from a bucket. Returns the file content.
$fileContent = $client->download([
    'FileId' => $file->getId()

    // Can also identify the file via bucket and path:
    // 'BucketName' => 'my-special-bucket',
    // 'FileName' => 'path/to/file'

    // Can also save directly to a location on disk. This will cause download() to not return file content.
    // 'SaveAs' => '/path/to/save/location'
]);

// Delete a file from a bucket. Returns true or false.
$fileDelete = $client->deleteFileFromArray([
    'FileId' => $file->getId()

    // Can also identify the file via bucket and path:
    // 'BucketName' => 'my-special-bucket',
    // 'FileName' => 'path/to/file'
]);

// Retrieve an array of file objects from a bucket.
$fileList = $client->listFilesFromArray([
    'BucketId' => '4d2dbbe08e1e983c5e6f0d12'
]);

// Create a new access key.
$capabilities = new Capabilities()
$key = $client->createKey($accountId, $name, new Capabilities(
    [Capabilities::DELETE_BUCKETS,
    Capabilities::LIST_ALL_BUCKET_NAMES,
    Capabilities::READ_BUCKETS]
));

$keyId = $key->getKeyId();
$applicationKeyId = $key->getApplicationKey();

// Delete an existing access key.
try {
    $client->deleteKey($keyId);
} catch (RequestException $e) {
    // $e->getCode()
}
```

Installation
------------

[](#installation)

Installation is via Composer:

```
$ composer require obregonco/backblaze-b2
```

Tests
-----

[](#tests)

Tests are run with PHPUnit. After installing PHPUnit via Composer (under development):

```
$ vendor/bin/phpunit
```

Contributors
------------

[](#contributors)

Feel free to contribute in any way you can whether that be reporting issues, making suggestions or sending PRs. :)

License
-------

[](#license)

LGPL.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 58% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~123 days

Recently: every ~79 days

Total

8

Last Release

1947d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c856ae829dc0d11e64f7142022edf7cfe49850341d99978a00b273aea3c72828?d=identicon)[robregonm](/maintainers/robregonm)

---

Top Contributors

[![robregonm](https://avatars.githubusercontent.com/u/1051457?v=4)](https://github.com/robregonm "robregonm (29 commits)")[![zeroSal-le](https://avatars.githubusercontent.com/u/259530781?v=4)](https://github.com/zeroSal-le "zeroSal-le (16 commits)")[![n0nag0n](https://avatars.githubusercontent.com/u/2322095?v=4)](https://github.com/n0nag0n "n0nag0n (2 commits)")[![jaytagdamian](https://avatars.githubusercontent.com/u/17107538?v=4)](https://github.com/jaytagdamian "jaytagdamian (1 commits)")[![rodber](https://avatars.githubusercontent.com/u/20590102?v=4)](https://github.com/rodber "rodber (1 commits)")[![struffel](https://avatars.githubusercontent.com/u/31403260?v=4)](https://github.com/struffel "struffel (1 commits)")

---

Tags

b2backblazebackblaze-adapterbackblaze-apibackblaze-b2phpphp-libraryfilesystemcloudbackupstorageb2backblazebackblaze-b2backblaze-api

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/obregonco-backblaze-b2/health.svg)

```
[![Health](https://phpackages.com/badges/obregonco-backblaze-b2/health.svg)](https://phpackages.com/packages/obregonco-backblaze-b2)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[gliterd/backblaze-b2

PHP SDK for working with backblaze B2 cloud storage.

83274.0k8](/packages/gliterd-backblaze-b2)[cwhite92/b2-sdk-php

A SDK for working with B2 cloud storage.

74151.7k2](/packages/cwhite92-b2-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)[innoge/laravel-rclone

A sleek PHP wrapper around rclone with Laravel-style fluent API syntax

175.9k](/packages/innoge-laravel-rclone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
