@@ -12,37 +12,58 @@ PHP Client for Vercel Blob Storage.
12
12
$client = new \VercelBlobPhp\Client();
13
13
```
14
14
15
+ Client constructor accepts token for blob storage, but if you connected your blob storage to project then you don't need to set it.
16
+
15
17
### Using Client
16
18
17
19
#### PUT
18
20
``` php
19
21
$result = $client->put(
20
- 'test.txt', // path
21
- 'hello world' // content,
22
- new \VercelBlobPhp\CommonCreateBlobOptions(
22
+ path: 'test.txt', // path
23
+ content: 'hello world' // content,
24
+ options: new \VercelBlobPhp\CommonCreateBlobOptions(
23
25
addRandomSuffix: true, // optional
24
26
contentType: 'text', // optional
25
27
cacheControlMaxAge: 123, // optional
26
28
)
27
29
);
28
-
29
- // $result is instance of PutBlobResult
30
- $result->url
31
- $result->downloadUrl
32
- $result->pathname
33
- $result->contentType
34
- $result->contentDisposition
35
30
```
36
31
37
- Third argument is optional.
32
+ Options argument is optional.
38
33
39
34
#### DEL
40
35
``` php
41
36
$client->del(['test.txt']);
42
37
```
43
38
44
39
#### COPY
40
+ ``` php
41
+ $result = $client->copy(
42
+ fromUrl: 'fromUrl',
43
+ toPathname: 'toPathname',
44
+ options: new \VercelBlobPhp\CommonCreateBlobOptions(
45
+ addRandomSuffix: true, // optional
46
+ contentType: 'text', // optional
47
+ cacheControlMaxAge: 123, // optional
48
+ )
49
+ );
50
+ ```
45
51
46
52
#### HEAD
53
+ ``` php
54
+ $result = $client->head('url');
55
+ ```
56
+
57
+ #### LIST
58
+ ``` php
59
+ $result = $client->list(
60
+ options: new \VercelBlobPhp\ListCommandOptions(
61
+ limit: 100, // optional
62
+ cursor: 'cursor', // optional
63
+ mode: \VercelBlobPhp\ListCommandMode::EXPANDED, // optional
64
+ prefix: 'prefix', // optional
65
+ )
66
+ );
67
+ ```
47
68
48
- #### LIST
69
+ Options argument is optional.
0 commit comments