PHPackages                             mervick/aes-bridge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. mervick/aes-bridge

ActiveLibrary[Security](/categories/security)

mervick/aes-bridge
==================

AesBridge is a modern, secure, and cross-language AES encryption library

v2.0.1(10mo ago)0216↓50%MITPHPCI passing

Since Jul 16Pushed 9mo agoCompare

[ Source](https://github.com/mervick/aes-bridge-php)[ Packagist](https://packagist.org/packages/mervick/aes-bridge)[ RSS](/packages/mervick-aes-bridge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

AesBridge PHP
=============

[](#aesbridge-php)

[![Packagist Version](https://camo.githubusercontent.com/c0c9b5e56d2d3abef8b64c03104c15a04e5f2212dce00687c890661dadde3193/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d65727669636b2f6165732d6272696467652e737667)](https://packagist.org/packages/mervick/aes-bridge)[![CI Status](https://github.com/mervick/aes-bridge-php/actions/workflows/codeception.yml/badge.svg)](https://github.com/mervick/aes-bridge-php/actions/workflows/codeception.yml)

**AesBridge** is a modern, secure, and cross-language **AES** encryption library. It offers a unified interface for encrypting and decrypting data across multiple programming languages. Supports **GCM**, **CBC**, and **legacy AES Everywhere** modes.

This is the **PHP implementation** of the core project.
👉 Main repository:

Features
--------

[](#features)

- 🔐 AES-256 encryption in GCM (recommended) and CBC modes
- 🌍 Cross-Platform: Consistent behavior across different languages
- 📦 Compact binary format or base64 output
- ✅ HMAC Integrity: CBC mode includes HMAC verification
- 🔄 Backward Compatible: Supports legacy AES Everywhere format

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- OpenSSL extension

Installation
------------

[](#installation)

```
composer require mervick/aes-bridge:"^2.0"
```

Basic Usage
-----------

[](#basic-usage)

```
use AesBridge\Gcm;
use AesBridge\Cbc;

// encrypt/decrypt using GCM mode (recommended)
$ciphertext = Gcm::encrypt("My secret message", "MyStrongPass")
$plaintext = Gcm::decrypt($ciphertext, "MyStrongPass")

// encrypt/decrypt using CBC mode
$ciphertext = Cbc::encrypt("My secret message", "MyStrongPass")
$plaintext = Cbc::decrypt($ciphertext, "MyStrongPass")
```

API Reference
-------------

[](#api-reference)

### GCM Mode (recommended)

[](#gcm-mode-recommended)

- `Gcm::encrypt(data, passphrase)`
    Encrypts a string using AES-GCM. **Returns:** base64-encoded string.
- `Gcm::decrypt(ciphertext, passphrase)`
    Decrypts a base64-encoded string encrypted with `Gcm::encrypt`.
- `Gcm::encryptBin(data, passphrase)`
    Returns encrypted binary data using AES-GCM.
- `Gcm::decryptBin(ciphertext, passphrase)`
    Decrypts binary data encrypted with `Gcm::encryptBin`.

### CBC Mode

[](#cbc-mode)

- `Cbc::encrypt(data, passphrase)`
    Encrypts a string using AES-CBC. HMAC is used for integrity verification.
    **Returns:** base64-encoded string.
- `Cbc::decrypt(ciphertext, passphrase)`
    Decrypts a base64-encoded string encrypted with `Cbc::encrypt` and verifies HMAC.
- `Cbc::encryptBin(data, passphrase)`
    Returns encrypted binary data using AES-CBC with HMAC.
- `Cbc::decryptBin(ciphertext, passphrase)`
    Decrypts binary data encrypted with `Cbc::encryptBin` and verifies HMAC.

### Legacy Compatibility

[](#legacy-compatibility)

⚠️ These functions are kept for backward compatibility only. Their usage is strongly discouraged in new applications.

- `Legacy::encrypt(data, passphrase)`
    Encrypts a string in the legacy AES Everywhere format.
- `Legacy::decrypt(ciphertext, passphrase)`
    Decrypts a string encrypted in the legacy AES Everywhere format.

Error Handling
--------------

[](#error-handling)

All methods throw exceptions for:

- Invalid input data
- Incorrect passwords
- Corrupted ciphertext
- HMAC verification failures (CBC mode)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance55

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

306d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbd6c1e93ed92f4ad92b9f53a7bad87eaa598a70bae172a3d40b1333c491b596?d=identicon)[mervick](/maintainers/mervick)

---

Top Contributors

[![mervick](https://avatars.githubusercontent.com/u/2429298?v=4)](https://github.com/mervick "mervick (23 commits)")

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/mervick-aes-bridge/health.svg)

```
[![Health](https://phpackages.com/badges/mervick-aes-bridge/health.svg)](https://phpackages.com/packages/mervick-aes-bridge)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
