https://github.com/linkorb/sops-php
SOPS PHP wrapper library
https://github.com/linkorb/sops-php
Last synced: 11 months ago
JSON representation
SOPS PHP wrapper library
- Host: GitHub
- URL: https://github.com/linkorb/sops-php
- Owner: linkorb
- Created: 2023-10-26T16:25:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-02T15:31:34.000Z (over 2 years ago)
- Last Synced: 2024-11-13T13:57:42.469Z (over 1 year ago)
- Language: PHP
- Size: 23.4 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Sops PHP wrapper libary
==============
[SOPS](https://github.com/getsops/sops) is an editor of encrypted files that supports YAML, JSON, ENV, INI and BINARY formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault, age, and PGP.
This repository provides a SOPS wrapper PHP library for PHP applications.
## Installation
```
composer require linkorb/sops-php
```
## Example
```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 usage
You can use the `bin/sops-php` CLI application to run commands for encryption/decryption.
The application needs a couple of configuration directives to work:
* Install SOPS (https://github.com/getsops/sops)
* [Age](https://age-encryption.org) or other encryption tool + key
### Example commands
# encryption
php bin/sops-php sops:encrypt -k age1tjzcc45rq3rlnt0hd6a77w9p90pdzmq3df7pdgtkrhynyxs25y2qltryk0 -m age composer.json
#decryption
php bin/sops-php sops:decrypt composer.sops.json