linkorb/sops-php

PHP 的 SOPS 封装库

v1.0.2 2023-11-02 15:19 UTC

This package is auto-updated.

Last update: 2024-08-31 00:30:13 UTC


README

SOPS 是一个支持 YAML、JSON、ENV、INI 和二进制格式的加密文件编辑器,并支持使用 AWS KMS、GCP KMS、Azure Key Vault、age 和 PGP 加密。

此存储库为 PHP 应用程序提供了 SOPS 封装 PHP 库。

安装

composer require linkorb/sops-php

示例

use linkORB\Shipyard\Sops as SopsWrapper;

// encrypt a file using a encryption method
$sops = new SopsWrapper();
$data = $sops->encrypt($key, $filepath, $method);

// encrypt a file using a encryption method
$sops = new SopsWrapper();
$data = $sops->decrypt($filepath);

CLI 使用

您可以使用 bin/sops-php CLI 应用程序来运行加密/解密命令。

应用程序需要一些配置指令才能运行

示例命令

# encryption
php bin/sops-php sops:encrypt -k age1tjzcc45rq3rlnt0hd6a77w9p90pdzmq3df7pdgtkrhynyxs25y2qltryk0 -m age  composer.json

#decryption
php bin/sops-php sops:decrypt composer.sops.json