Skip to content

Latest commit

 

History

History

kms

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Google Cloud KMS API Samples

Open in Cloud Shell

Description

These samples demonstrate how to invoke Google Cloud KMS from PHP.

Build and Run

  1. Enable APIs - Enable the KMS 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/kms
    
  4. Install dependencies via Composer. If composer is installed locally:

    $ php composer.phar install
    

    If composer is installed globally:

    $ composer install
    
  5. Execute the snippets in the src/ directory by running:

    $ php src/SNIPPET_NAME.php
    

    The usage will print for each if no arguments are provided.

See the Cloud KMS Documentation for more information.

Contributing changes

Licensing