wapacro/az-keyvault-php
Composer 安装命令:
composer require wapacro/az-keyvault-php
包简介
PHP Library to work with Azure KeyVault using managed identity
README 文档
README
This library allows easy integration of Azure Key Vault in PHP applications.
Highlights
- Built-in managed identity support
Setup managed identities for your apps and centralise all secrets, keys and certificates in Azure Key Vault. Get secure access directly from your code without worrying about credentials. - Easy to use API
This library's API is simple and easy to understand. After some setup in Azure and a few lines of code you're good to go! - Works with Windows & Linux based App Service Plans and Virtual Machines
How to use
Get started in three simple steps!
- Add a system-assigned identity to your Azure App Service and assign permissions to your application to read & list secrets from Key Vault
- Install this package in your project
using Composer
composer require wapacro/az-keyvault-php - Access your secrets & keys in Key Vault using the simple API:
<?php /** * Secrets */ $secret = new AzKeyVault\Secret('https://my-keyvault-dns.vault.azure.net'); // If you want to get all secrets (default max to 25): $secrets = $secret->getSecrets(); // ... else get next page via nextLink $secrets = $secret->getSecrets($secrets->getNextLink()); // If you want the latest secret $value = $secret->getSecret('mySecretName'); // If you want a specific secret version: $value = $secret->getSecret('mySecretName', '9fe63d32-5eb0-47f2-8ef8-version-id'); // ... otherwise get all versions of secret // with name "mySecretName" which are marked // as enabled and retrieve the first one $enabledSecretVersions = $secret->getSecretVersions('mySecretName')->enabled(); $firstEnabledVersion = reset($enabledSecretVersions); $value = $secret->getSecret($firstEnabledVersion); echo $value->secret; // prints: my super secret message // If you want to set secret or update secret with newer version: $value = $secret->setSecret('mySecretName', 'mySecretValue'); echo $value->secret; // prints: mySecretValue /** * Keys */ $key = new AzKeyVault\Key('https://my-keyvault-dns.vault.azure.net'); // Retrieve specific key version: $value = $key->getKey('myKeyName', 'j7d8rd32-5eb0-47f2-8ef8-version-id'); // ... or get all versions of a key // and retrieve the first one which // is enabled, just like with the // secrets above $enabledKeyVersions = $key->getKeyVersions('myKeyName')->enabled(); $firstEnabledVersion = reset($enabledKeyVersions); $value = $key->getKey($firstEnabledVersion); echo $value->type; // e.g. "RSA" echo $value->n; // prints base64 encoded RSA modulus // This library also provides some key utilities // to make retrieved keys work with the OpenSSL extension $pem = (new AzKeyVault\KeyUtil($value))->toPEM(); $keyDetails = openssl_pkey_get_details(openssl_pkey_get_private($pem)); var_dump($keyDetails);
Note: KeyUtil supports RSA and EC keys
Planned features
- Accessing certificates
wapacro/az-keyvault-php 适用场景与选型建议
wapacro/az-keyvault-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 50.24k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2020 年 05 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「azure」 「secret」 「keyvault」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wapacro/az-keyvault-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wapacro/az-keyvault-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wapacro/az-keyvault-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Secrets Manager for PHP
Secrets Manager Bundle for Symfony
Small library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.
A simple wrapper for the Azure RM Key Vault API.
A PHP library to encrypt/decrypt secrets using OpenSSL.
A Symfony bundle to handle secrets.
统计信息
- 总下载量: 50.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-05-17