codenamephp/platform.secretsmanager.googlesecretsmanager

1.0.0 2023-03-13 13:12 UTC

This package is auto-updated.

Last update: 2024-04-13 18:33:32 UTC


README

Packagist Version Packagist PHP Version Support Lines of code GitHub code size in bytes CI Packagist Downloads GitHub

Installation

Easiest way is via composer. Just run composer require codenamephp/platform.secretsManager.googleSecretsManager in your cli which should install the latest version for you.

Usage

Just create a client using the factory and start fetching secrets. Note that you need to have a google authentication setup. Since we just use the google client by default the instructions from Google apply: https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md

You can also pass the path to the credentials file to the factory if you so prefer. Whatever string you pass to the factory is just passed on to the google client so it can do its thing. So check the google doc for details.

use de\codenamephp\platform\secretsManager\googleSecretsManager\Client\Factory\WithGoogleSecretsManagerClient;

$client = (new WithGoogleSecretsManagerClient())->build();
$client = (new WithGoogleSecretsManagerClient())->build('/path/to/credentials.json');

// payload is fetched as string
$payload = $client->fetchPayload(new \de\codenamephp\platform\secretsManager\base\Secret\Sealed('mySecret', 'myProject')); //fetch the latest version
$payload = $client->fetchPayload(new \de\codenamephp\platform\secretsManager\base\Secret\Sealed('mySecret', 'myProject', '3')); //fetch a specific version