44
55This simple command-line application demonstrates how to invoke Google Cloud Storage from PHP.
66
7+ ## Licensing
8+
9+ * See [ LICENSE] ( ../../LICENSE )
10+
711## Build and Run
8- 1 . ** Enable APIs** - [ Enable the Cloud Storage JSON API] ( https://console.cloud.google.com/flows/enableapi?apiid=storage_api )
12+ 1 . ** Enable APIs** - [ Enable the Storage API] ( https://console.cloud.google.com/flows/enableapi?apiid=storage_api )
913 and create a new project or select an existing project.
10142 . ** Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click "New Credentials"
1115 and select "Service Account Key". Create a new service account, use the JSON key type, and
@@ -15,41 +19,23 @@ This simple command-line application demonstrates how to invoke Google Cloud Sto
1519
1620 ``` sh
1721 $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
18- $ cd php-docs-samples/storage/api
22+ $ cd php-docs-samples/storage/cli
1923```
20244 . ** Install dependencies** via [ Composer] ( http://getcomposer.org/doc/00-intro.md ) .
2125 Run ` php composer.phar install ` (if composer is installed locally) or ` composer install `
2226 (if composer is installed globally).
23- 5 . Run ` php listBuckets.php YOUR_PROJECT_NAME ` where YOUR_PROJECT_NAME is the
24- project associated with the credentials from ** step 2** .
27+ 5 . Run ` php storage.php ` . The following commands are available:
2528
2629 ``` sh
27- $ php listBuckets.php my-project-name
28- my-project-name-bucket1
29- my-project-name-bucket2
30- my-project-name-bucket3
30+ bucket-acl Manage the ACL for Cloud Storage buckets.
31+ bucket-default-acl Manage the default ACL for Cloud Storage buckets.
32+ buckets Manage Cloud Storage buckets
33+ encryption Upload and download Cloud Storage objects with encryption
34+ object-acl Manage the ACL for Cloud Storage objects
35+ objects Manage Cloud Storage objects
3136```
32- 6 . Run ` php listObjects.php YOUR_PROJECT_NAME YOUR_BUCKET_NAME ` where YOUR_PROJECT_NAME is the
33- project associated with the credentials from ** step 2** and YOUR_BUCKET_NAME is a bucket from the list of bucket names in ** step 5** .
34-
35- ``` sh
36- $ php listBuckets.php my-project-name my-project-name-bucket1
37- my-project-name-bucket1-object1
38- my-project-name-bucket1-object2
39- my-project-name-bucket1-object3
40- ```
41- 7 . Run ` php listObjects.php YOUR_PROJECT_NAME YOUR_BUCKET_NAME YOUR_OBJECT_NAME ` where YOUR_PROJECT_NAME is the project associated with the credentials from ** step 2** and YOUR_BUCKET_NAME is a bucket from the list of bucket names in ** step 5** and YOUR_OBJECT_NAME is an object name from the list of objects in ** step 6** .
42-
43- ``` sh
44- $ php downloadObject.php my-project-name my-project-name-bucket1 my-project-name-bucket1-object1 myfile.txt
45- File written to myfile.txt
46- ```
47-
37+ 6 . Run ` php storage.php COMMAND --help ` to print information about the usage of each command.
4838
4939## Contributing changes
5040
5141* See [ CONTRIBUTING.md] ( ../../CONTRIBUTING.md )
52-
53- ## Licensing
54-
55- * See [ LICENSE] ( ../../LICENSE )
0 commit comments