PHPackages                             ukn0me/b2-api - 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. [API Development](/categories/api)
4. /
5. ukn0me/b2-api

AbandonedArchivedLibrary[API Development](/categories/api)

ukn0me/b2-api
=============

Backblaze B2 API wrapper for PHP

v0.2.1-alpha(10y ago)61171MITPHPPHP &gt;=5.3.3

Since Feb 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/UKn0Me/b2-api)[ Packagist](https://packagist.org/packages/ukn0me/b2-api)[ RSS](/packages/ukn0me-b2-api/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

\#Backblaze B2 PHP API Wrapper Forked by [Aidhan Dossel](https://aidhan.net/), originally by [Dan Rovito](https://www.danrovito.com)

This is a PHP wrapper for the [Backblaze B2](https://www.backblaze.com/b2/cloud-storage.html) API.

This wrapper is in alpha and should not be used on production sites.

\##Usage

1. Clone the repository

```
git clone https://github.com/UKn0Me/b2-api.git

```

2. Include b2\_api.php when required

```
include "/path/to/b2_api.php"; // Include the API wrapper
```

OR

For you folks that use Composer

```
  composer require ukn0me/b2-api

```

\####Requirements

- PHP 5.3.3+ (works on 7.0)
- php-curl
- php-json
- php-mbstring If you're using Composer, it should get all the dependencies figured out but you still need to have the PHP extensions installed.

\###Sample code You need to pass your Account ID and Application key from your B2 account to get your authorization response. To call the authorization function do the following:

```
$b2 = new b2_api;
$response = $b2->b2_authorize_account("ACCOUNTID", "APPLICATIONKEY");
return $response;
```

The response will contain the following as an array:

- acccountId
- authorizationToken
- apiUrl
- downloadUrl

\##Calls

Currently only the following API calls are supported, see the examples directory for full examples or see [B2 API](https://www.backblaze.com/b2/docs/) for more information about each call.

#### b2\_create\_bucket

[](#b2_create_bucket)

```
b2_create_bucket($api_url, $account_id, $auth_token, $bucket_name, $bucket_type)

$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_name // The new bucket's name. 6 char min, 50 char max, letters, digits, - and _ are allowed
$bucket_type // Type to create the bucket as, either allPublic or allPrivate
```

#### b2\_delete\_bucket

[](#b2_delete_bucket)

```
b2_delete_bucket($api_url, $account_id, $auth_token, $bucket_id)

$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket you want to delete
```

#### b2\_delete\_file\_version

[](#b2_delete_file_version)

```
b2_delete_file_version($api_url, $auth_token, $file_id, $file_name)

$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$file_id // The ID of the file you want to delete
$file_name // The file name of the file you want to delete
```

#### b2\_download\_file\_by\_id

[](#b2_download_file_by_id)

```
b2_download_file_by_id($download_url, $file_id, [$auth_token])

$download_url // The download URL, obtained from the b2_authorize_account call
$file_id // The ID of the file you wish to download
$auth_token // Only required if bucket is private, obtained from the b2_authorize_account call
```

#### b2\_download\_file\_by\_name

[](#b2_download_file_by_name)

```
b2_download_file_by_name($download_url, $bucket_name, $file_name, [$auth_token]);

$download_url // The download URL, obtained from the b2_authorize_account call
$bucket_name // The name of the bucket you wish to download from
$file_name // The name of the file you wish to download
$auth_token // Only required if bucket is private, obtained from the b2_authorize_account call
```

#### b2\_get\_file\_info

[](#b2_get_file_info)

```
b2_get_file_info($api_url, $auth_token, $file_id)

$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$file_id // The ID of the file you wish to recieve the info of
```

#### b2\_get\_upload\_url

[](#b2_get_upload_url)

```
b2_get_upload_url($api_url, $account_id, $auth_token, $bucket_id)

$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket you want to upload to
```

#### b2\_hide\_file

[](#b2_hide_file)

```
b2_hide_file($api_url, $auth_token, $bucket_id, $file_name)

$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket containing the file you wish to hide
$file_name // The name of the file you wish to hide
```

#### b2\_list\_buckets

[](#b2_list_buckets)

```
b2_list_buckets($api_url, $auth_token, $account_id)

$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
```

#### b2\_list\_file\_names

[](#b2_list_file_names)

```
b2_list_file_names($api_url, $auth_token, $bucket_id, [$options])

$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket containing the files you wish to list

$options = array( // None of these options are required but may be used
    "max_count" => "", // The maxiumum amount of file names to list in a call
    "start_name" => "" // If the specified file name exists, it's the first listed
);
```

#### b2\_list\_file\_versions

[](#b2_list_file_versions)

```
b2_list_file_versions($api_url, $auth_token, $bucket_id, [$options])

$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket containing the files you wish to list

$options = array( // None of these options are required but may be used
    "max_count" => "", // The maxiumum amount of file names to list in a call
    "start_id" => "", // If the specified file ID exists, it's the first listed
    "start_name" => "" // If the specified file name exists, it's the first listed
);
```

#### b2\_update\_bucket

[](#b2_update_bucket)

```
b2_update_bucket($api_url, $account_id, $auth_token, $bucket_id, $bucket_type)

$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket you want to update
$bucket_type // Type to change to, either allPublic or allPrivate
```

#### b2\_upload\_file

[](#b2_upload_file)

```
b2_upload_file($upload_url, $auth_token, $file_path)

$upload_url // Upload URL, obtained from the b2_get_upload_url call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$file_path // The path to the file you wish to upload
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.8% 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 ~0 days

Total

2

Last Release

3783d ago

### Community

Maintainers

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

---

Top Contributors

[![danrovito](https://avatars.githubusercontent.com/u/8322674?v=4)](https://github.com/danrovito "danrovito (37 commits)")[![aidhand](https://avatars.githubusercontent.com/u/4907668?v=4)](https://github.com/aidhand "aidhand (26 commits)")[![geek-at](https://avatars.githubusercontent.com/u/2073090?v=4)](https://github.com/geek-at "geek-at (1 commits)")

---

Tags

apib2backblaze

### Embed Badge

![Health badge](/badges/ukn0me-b2-api/health.svg)

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

###  Alternatives

[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22779.5k](/packages/m165437-laravel-blueprint-docs)

PHPackages © 2026

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