This simple command-line application demonstrates how to invoke Google Cloud Storage from PHP.
- See LICENSE
-
Enable APIs - Enable the Storage API and create a new project or select an existing project.
-
Download The Credentials - Click "Go to credentials" after enabling the APIs. Click "New Credentials" and select "Service Account Key". Create a new service account, use the JSON key type, and select "Create". Once downloaded, set the environment variable
GOOGLE_APPLICATION_CREDENTIALSto the path of the JSON key that was downloaded. -
Clone the repo and cd into this directory
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples $ cd php-docs-samples/storage -
Install dependencies via Composer. Run
php composer.phar install(if composer is installed locally) orcomposer install(if composer is installed globally). -
Run
php storage.php. The following commands are available:bucket-acl Manage the ACL for Cloud Storage buckets. bucket-default-acl Manage the default ACL for Cloud Storage buckets. bucket-labels Manage Cloud Storage bucket labels buckets Manage Cloud Storage buckets encryption Upload and download Cloud Storage objects with encryption object-acl Manage the ACL for Cloud Storage objects objects Manage Cloud Storage objects requester-pays Manage Cloud Storage requester pays buckets and objects
-
Run
php storage.php COMMAND --helpto print information about the usage of each command.
- See CONTRIBUTING.md
