pantheon-systems/customer-secrets-php-sdk

Supporting libraries for customer secrets project

v1.0.0-alpha1 2023-01-05 20:04 UTC

This package is auto-updated.

Last update: 2023-05-10 20:54:17 UTC


README

This library should be used to access Pantheon Sites Secrets (currently in EA).

Early Access

The Secrets feature is available for Early Access participants. Features for Secrets are in active development. Pantheon's development team is rolling out new functionality often while this product is in Early Access. Visit the Pantheon Slack channel (or sign up for the channel if you don't already have an account) to learn how you can enroll in our Early Access program. Please review Pantheon's Software Evaluation Licensing Terms for more information about access to our software.

Installation

Use composer to install it:

composer require pantheon-systems/customer-secrets-php-sdk

Usage

In your PHP code, do the following:

use PantheonSystems\CustomerSecrets\CustomerSecrets;

$client = CustomerSecrets::create()->getClient();
$secret = $client->getSecret('foo');
$secret_value = $secret->getValue();

// You could also get all of your secrets like this:
$secrets = $client->getSecrets();

See the included classes and internal documentation for more examples and use cases.

Note: Only get has been implemented so far. You should handle your secrets through terminus using Terminus Secrets Manager.

See our detailed Drupal or WordPress examples for more detailed end to end examples.

Restrictions

This SDK will only read secrets with scope web. Secrets get cached in the server for 15 minutes so you should wait (at most) that time if you modified your site secrets.