pantheon-systems/customer-secrets-php-sdk
Composer 安装命令:
composer require pantheon-systems/customer-secrets-php-sdk
包简介
Supporting libraries for customer secrets project
README 文档
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.
Local Environment Usage
The SDK includes a CustomerSecretsFakeClient implementation that is used when the SDK runs outside of Pantheon infrastructure. This client uses a secrets json file to build the secrets information emulating what happens on the platform using the Secrets service.
To get this file, you should use the plugin secret:site:local-generate command and then set an environment variable into your local environment (or docker container if you are running a dockerized environment) with name CUSTOMER_SECRETS_FAKE_FILE and use the absolute path to the file as the value.
Lando example
To setup this using lando, you should modify your .lando.yml like this:
services:
appserver:
overrides:
environment:
CUSTOMER_SECRETS_FAKE_FILE: /app/secrets.json
Then, generate the secrets file like this:
terminus secret:site:local-generate --filepath=./secrets.json
And rebuild lando application:
lando rebuild -y
Then, you will be able to use your secrets through the SDK.
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.
pantheon-systems/customer-secrets-php-sdk 适用场景与选型建议
pantheon-systems/customer-secrets-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 551.1k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pantheon-systems/customer-secrets-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pantheon-systems/customer-secrets-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 551.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 16
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-06