datahihi1/tiny-env-encryptor

Encrytor helper for TinyEnv: A simple PHP library to manage environment variables in a secure way.

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/datahihi1/tiny-env-encryptor

dev-main 2025-12-10 17:59 UTC

This package is auto-updated.

Last update: 2025-12-10 18:00:06 UTC


README

Tiny Env Encryptor is a simple PHP command-line tool that helps you securely manage your environment variables by encrypting and decrypting them using the TinyEnv library.

Requirements

  • PHP 7.1 or higher
  • Composer

Installation

composer require datahihi1/tiny-env-encryptor:dev-main

Usage

After installation, you can use the tiny-env-encrypt command-line tool.

Generate Encryption Key

To generate a new encryption key, run:

vendor/bin/tiny-env-encrypt generate-key

This will create a key and display it. Store this key securely, as you'll need it for encryption and decryption.

Encrypt .env File

To encrypt your .env file, use the following command:

vendor/bin/tiny-env-encrypt encrypt <secret_key> .env [.env.encrypted] [key1 key2 ...]
- `<secret_key>`: The encryption key generated earlier.
- `.env`: The input file containing environment variables.
- `[.env.encrypted]`: (Optional) The output file to save the encrypted variables. If not provided, it will overwrite the input file.
- `[key1 key2 ...]`: (Optional) Specific keys to encrypt. If not provided, all variables will be encrypted.

Decrypt .env File

To decrypt your encrypted .env file, use the following command:

vendor/bin/tiny-env-encrypt decrypt <secret_key> .env.encrypted [.env.decrypted]
- `<secret_key>`: The encryption key used for encryption.
- `.env.encrypted`: The input file containing encrypted environment variables.
- `[.env.decrypted]`: (Optional) The output file to save the decrypted variables. If not provided, it will overwrite the input file.

Or helper:

$value = decrypt_env($value, $secretKey);