https://github.com/dam-bal/vercel-blob-php
Vercel Blob Client for PHP
https://github.com/dam-bal/vercel-blob-php
blob blob-storage client php storage vercel
Last synced: 5 months ago
JSON representation
Vercel Blob Client for PHP
- Host: GitHub
- URL: https://github.com/dam-bal/vercel-blob-php
- Owner: dam-bal
- License: mit
- Created: 2024-04-14T06:37:37.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-21T19:51:56.000Z (about 2 years ago)
- Last Synced: 2025-10-06T13:56:15.826Z (9 months ago)
- Topics: blob, blob-storage, client, php, storage, vercel
- Language: PHP
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Vercel Blob PHP
PHP Client for Vercel Blob Storage.
[Vercel Blob](https://vercel.com/docs/storage/vercel-blob)
## Install
```shell
composer require dam-bal/vercel-blob-php
```
## Usage
### Creating Client
```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.
### Using Client
#### PUT
```php
$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.
#### DEL
```php
$client->del(['test.txt']);
```
#### COPY
```php
$result = $client->copy(
fromUrl: 'fromUrl',
toPathname: 'toPathname',
options: new \VercelBlobPhp\CommonCreateBlobOptions(
addRandomSuffix: true, // optional
contentType: 'text', // optional
cacheControlMaxAge: 123, // optional
)
);
```
#### HEAD
```php
$result = $client->head('url');
```
#### LIST
```php
$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.