|
7 | 7 |
|
8 | 8 | ## Description
|
9 | 9 |
|
10 |
| -These samples show how to use the |
11 |
| -[Google Cloud KMS API](https://cloud.google.com/kms/docs/reference/libraries) from PHP. |
| 10 | +These samples demonstrate how to invoke [Google Cloud KMS][kms] from PHP. |
12 | 11 |
|
13 | 12 | ## Build and Run
|
14 |
| -1. **Enable APIs** - [Enable the KMS API](https://console.cloud.google.com/flows/enableapi?apiid=cloudkms.googleapis.com) |
| 13 | + |
| 14 | +1. **Enable APIs** - [Enable the KMS |
| 15 | + API](https://console.cloud.google.com/flows/enableapi?apiid=cloudkms.googleapis.com) |
15 | 16 | and create a new project or select an existing project.
|
16 |
| -2. **Activate your Credentials** - If you do not already have an active set of credentials, create and download a [JSON Service Account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey). Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` as the path to the downloaded JSON file. |
17 |
| -3. **Clone the repo** and cd into this directory |
18 | 17 |
|
19 |
| - ``` |
| 18 | +1. **Download The Credentials** - Click "Go to credentials" after enabling the |
| 19 | + APIs. Click "New Credentials" and select "Service Account Key". Create a new |
| 20 | + service account, use the JSON key type, and select "Create". Once |
| 21 | + downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to |
| 22 | + the path of the JSON key that was downloaded. |
| 23 | + |
| 24 | +1. **Clone the repo** and cd into this directory |
| 25 | + |
| 26 | + ```text |
20 | 27 | $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
|
21 | 28 | $ cd php-docs-samples/kms
|
22 | 29 | ```
|
23 |
| -4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md). |
24 |
| - Run `php composer.phar install` (if composer is installed locally) or `composer install` |
25 |
| - (if composer is installed globally). |
26 |
| -5. Run `php src/SNIPPET_NAME.php`. The usage will print for each if no arguments |
27 |
| - are provided: |
28 |
| - ```sh |
29 |
| - $ php src/create_dataset.php |
30 |
| - Usage: php src/list_keyrings.php PROJECT_ID LOCATION |
31 |
| -
|
32 |
| - $ php src/list_keyrings.php your-project-id us-west1 |
33 |
| - Name: projects/your-project-id/locations/us-west1/keyRings/your-test-keyring |
34 |
| - Create Time: 2018-12-28 06:27:56 |
| 30 | +
|
| 31 | +1. **Install dependencies** via [Composer][install-composer]. If composer is |
| 32 | + installed locally: |
| 33 | +
|
| 34 | + ```text |
| 35 | + $ php composer.phar install |
35 | 36 | ```
|
36 | 37 |
|
| 38 | + If composer is installed globally: |
| 39 | +
|
| 40 | + ```text |
| 41 | + $ composer install |
| 42 | + ``` |
| 43 | +
|
| 44 | +1. Execute the snippets in the [src/](src/) directory by running: |
| 45 | +
|
| 46 | + ```text |
| 47 | + $ php src/SNIPPET_NAME.php |
| 48 | + ``` |
| 49 | +
|
| 50 | + The usage will print for each if no arguments are provided. |
| 51 | +
|
| 52 | +See the [Cloud KMS Documentation](https://cloud.google.com/kms/docs) for more |
| 53 | +information. |
| 54 | +
|
37 | 55 | ## Contributing changes
|
38 | 56 |
|
39 | 57 | * See [CONTRIBUTING.md](../CONTRIBUTING.md)
|
40 | 58 |
|
41 | 59 | ## Licensing
|
42 | 60 |
|
43 | 61 | * See [LICENSE](../LICENSE)
|
| 62 | +
|
| 63 | +[install-composer]: http://getcomposer.org/doc/00-intro.md |
| 64 | +[kms]: https://cloud.google.com/kms |
0 commit comments