Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src [Storage] Support UniformBucketLevelAccess (#936) Oct 10, 2019
test [Storage] Support UniformBucketLevelAccess (#936) Oct 10, 2019
README.md
composer.json [Storage] Support UniformBucketLevelAccess (#936) Oct 10, 2019
phpunit.xml.dist
quickstart.php standardize storage samples (#502) Dec 5, 2017
storage.php [Storage] Support UniformBucketLevelAccess (#936) Oct 10, 2019

README.md

Google Cloud Storage PHP Sample Application

Open in Cloud Shell

Description

This simple command-line application demonstrates how to invoke Google Cloud Storage from PHP.

Licensing

Build and Run

  1. Enable APIs - Enable the Storage API and create a new project or select an existing project.

  2. 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_CREDENTIALS to the path of the JSON key that was downloaded.

  3. Clone the repo and cd into this directory

    $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
    $ cd php-docs-samples/storage
  4. Install dependencies via Composer. Run php composer.phar install (if composer is installed locally) or composer install (if composer is installed globally).

  5. 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
    bucket-lock                      Manage Cloud Storage retention policies and holds
    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
    uniform-bucket-level-access      Manage Cloud Storage uniform bucket-level access buckets
    get-object-v2-signed-url         Generate a v2 signed URL for downloading an object.
    get-object-v4-signed-url         Generate a v4 signed URL for downloading an object.
    get-object-v4-upload-signed-url  Generate a v4 signed URL for uploading an object.
    hmac-sa-manage                   Manage HMAC Service Account keys.
    hmac-sa-list                     List HMAC Service Account keys.
    hmac-sa-create                   Create an HMAC Service Account key.
  6. Run php storage.php COMMAND --help to print information about the usage of each command.

Contributing changes

You can’t perform that action at this time.