Download the PHP package temant/encryption-manager without Composer

On this page you can find all versions of the php package temant/encryption-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package encryption-manager

Temant Encryption Manager

Build Status Coverage Status License PHPStan

Temant Encryption Manager is a small, focused authenticated-encryption (AEAD) library for PHP, built exclusively on AES-GCM. It provides a simple API for encrypting and decrypting strings and files, with two independent key-derivation modes and support for key rotation and large-file streaming.

Installation

Requires PHP ^8.5 and the openssl extension.

Usage

Encrypting strings (app secret)

encryptString() returns a versioned, printable payload (v1: + base64) safe to store in a database column or JSON field.

Encrypting strings with a password

Pass a password as the second argument to switch to PBKDF2-based key derivation with a random per-message salt, instead of the app-secret-derived key:

Custom configuration

Cipher choice, PBKDF2 iteration count, salt/tag sizes, and the HKDF info string are all configurable via EncryptionConfig:

A manager only decrypts payloads produced with a matching cipher — mixing AES_128_GCM and AES_256_GCM payloads under one manager instance throws. pbkdf2Iterations, saltBytes, and tagBytes must all be positive integers; EncryptionConfig validates this at construction time and throws EncryptionException immediately rather than failing cryptically later inside OpenSSL.

Key rotation

Rotating your app secret doesn't have to invalidate previously-encrypted data. By default, updateSecret() keeps the old secret in an in-memory keyring, so old payloads stay decryptable:

To rotate without keeping the old secret around (immediately invalidating old data), pass retireCurrent: false:

If your process restarts and needs to rebuild the keyring (e.g. from a secrets manager), pass retired secrets at construction time or add them later:

Key rotation only applies to app-secret mode. Password-mode encryption always derives its key from the password you pass in, so there's nothing to rotate on the manager itself.

File encryption

For small files, encryptFile()/decryptFile() load the whole file into memory and reuse the same versioned payload format as encryptString():

Streaming file encryption (large files)

For large files, use encryptStreamedFile()/decryptStreamedFile() instead. They process the file in fixed-size chunks (default 64 KB) instead of loading it fully into memory, and use a distinct binary chunked format — not interchangeable with encryptFile()/decryptFile():

Each chunk is independently authenticated, and the chunk index plus a "final chunk" flag are bound into that chunk's nonce. This means truncating, reordering, duplicating, or splicing chunks is detected as an authentication failure during decryption rather than silently producing corrupted output.

Error handling

All failures — invalid payloads, tampered ciphertext, wrong passwords, cipher mismatches, missing files, I/O errors — throw Temant\EncryptionManager\EncryptionException:

Running Tests

License

This project is licensed under the MIT License.


All versions of encryption-manager with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package temant/encryption-manager contains the following files

Loading the files please wait ...