PHPackages                             quranacademy/b2-php-sdk - 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. quranacademy/b2-php-sdk

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

quranacademy/b2-php-sdk
=======================

An SDK for working with B2 cloud storage

19PHP

Since May 19Pushed 6y ago3 watchersCompare

[ Source](https://github.com/quranacademy/b2-php-sdk)[ Packagist](https://packagist.org/packages/quranacademy/b2-php-sdk)[ RSS](/packages/quranacademy-b2-php-sdk/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

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

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

[![Build Status](https://camo.githubusercontent.com/dbdc25d5aec788f2a14595eeeb671e5502cc746783ef77fe74b2feef9db1361f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f717572616e61636164656d792f62322d7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/quranacademy/b2-php-sdk)[![Total Downloads](https://camo.githubusercontent.com/467b3a852a4e9891623e5eff63e03fe3ef55170b19f8fc2b60d496a123e3924d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f717572616e61636164656d792f62322d7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/quranacademy/b2-php-sdk)[![Latest Version](https://camo.githubusercontent.com/8067c964b9b8da2b6d5e83234d4983035fe5d1b8e2fb3a54ae3967a329ed6b4b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f717572616e61636164656d792f62322d7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://github.com/quranacademy/b2-php-sdk/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

`b2-php-sdk` is a client library for working with Backblaze 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.

**[Backblaze B2 documentation](https://www.backblaze.com/b2/docs/)**

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

[](#installation)

To install Backblaze B2 SDK run the command:

```
$ composer require quranacademy/b2-php-sdk
```

Usage
-----

[](#usage)

Most methods of the SDK returns the body of the response from B2 API. Check out [Backblaze B2 documentation](https://www.backblaze.com/b2/docs/) to see what fields will be returned.

```
use Backblaze\B2Client;
use Backblaze\HttpClient\CurlHttpClient;

$httpClient = new CurlHttpClient();

$client = new B2Client($httpClient);

$client->authorize('accountId', 'applicationKey');

// see "b2_create_bucket" operation in the docs
$bucket = $client->createBucket([
    'BucketName' => 'my-bucket',
    'BucketType' => B2Client::BUCKET_TYPE_PRIVATE, // or BUCKET_TYPE_PUBLIC
]);

// change the bucket to public
// see "b2_update_bucket"
$updatedBucket = $client->updateBucket([
    'BucketId' => $bucket['bucketId'],
    'BucketType' => B2Client::BUCKET_TYPE_PUBLIC,
]);

// retrieve a list of buckets on your account
// see "b2_list_buckets"
$buckets = $client->listBuckets();

// delete a bucket
// see "b2_delete_bucket"
$client->deleteBucket([
    'BucketId' => $bucket['bucketId'],
]);

// retrieve an array of file objects from a bucket
// see "b2_list_file_names"
$fileList = $client->listFiles([
    'BucketId' => '4a48fe8875c6214145260818',
]);

$fileExistence = $client->fileExists([
    'BucketId' => '4a48fe8875c6214145260818',
    'file' => 'path/to/file',
]);

// upload a file to a bucket
// see "b2_upload_file"
$file = $client->upload([
    'BucketId' => '4a48fe8875c6214145260818',
    'FileName' => 'path/to/upload/to',
    'Body' => 'File content',

    // the file content can also be provided via a resource
    // 'Body' => fopen('/path/to/source/file', 'r'),

    // or as the path to a source file
    // 'SourceFile' => '/path/to/source/file',
]);

$fileId = '4_z942111fa0b943d89249a0815_f1001e9fa2c42d9a8_d20170119_m162445_c001_v0001032_t0057';

// download a file from a bucket
$client->download([
    'FileId' => $fileId,
    'SaveAs' => '/path/to/save/location',
]);

// delete a file from a bucket
// see "b2_delete_file_version"
$fileDelete = $client->deleteFile([
    'FileId' => $fileId,
    'FileName' => '/path/to/file',
]);
```

Tests
-----

[](#tests)

Tests are run with PHPUnit. After installing PHPUnit via Composer:

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

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

[](#contributors)

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

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![Imangazaliev](https://avatars.githubusercontent.com/u/11244193?v=4)](https://github.com/Imangazaliev "Imangazaliev (1 commits)")

---

Tags

b2backblaze

### Embed Badge

![Health badge](/badges/quranacademy-b2-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/quranacademy-b2-php-sdk/health.svg)](https://phpackages.com/packages/quranacademy-b2-php-sdk)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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