PHP Client for Vercel Blob Storage.
composer require dam-bal/vercel-blob-php
$client = new \VercelBlobPhp\Client();
Client constructor accepts token for blob storage, but if you connected your blob storage to project then you don't need to set it.
$result = $client->put(
path: 'test.txt', // path
content: 'hello world' // content,
options: new \VercelBlobPhp\CommonCreateBlobOptions(
addRandomSuffix: true, // optional
contentType: 'text', // optional
cacheControlMaxAge: 123, // optional
)
);
Options argument is optional.
$client->del(['test.txt']);
$result = $client->copy(
fromUrl: 'fromUrl',
toPathname: 'toPathname',
options: new \VercelBlobPhp\CommonCreateBlobOptions(
addRandomSuffix: true, // optional
contentType: 'text', // optional
cacheControlMaxAge: 123, // optional
)
);
$result = $client->head('url');
$result = $client->list(
options: new \VercelBlobPhp\ListCommandOptions(
limit: 100, // optional
cursor: 'cursor', // optional
mode: \VercelBlobPhp\ListCommandMode::EXPANDED, // optional
prefix: 'prefix', // optional
)
);
Options argument is optional.