Skip to content

CreateBucket

Craig edited this page Jan 1, 2024 · 2 revisions

How To Use

<?php

use TechKat\BackBlazeB2\Bucket;
use TechKat\BackBlazeB2\Client;

$keyID = '...';
$applicationKey = '...';

$client = new Client($keyID, $applicationKey);

$response = $client->createBucket([
  'bucketName' => 'This-Bucket-Is-So-Cool',
  'bucketType' => Bucket::TYPE_PRIVATE,
]);

return $response;

Expected Result

After the successful creation of a bucket, instead of a typical JSON response from the API, a new Bucket model will be created, providing the use of the methods listed here:

https://github.com/TechKat/backblaze-b2-php-sdk/wiki/BucketModel

Backblaze B2 API Documentation

https://www.backblaze.com/apidocs/b2-create-bucket