PHPackages                             legierski/aes - 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. legierski/aes

ActiveLibrary[Security](/categories/security)

legierski/aes
=============

OpenSSL-compatible AES library

0.1.0(11y ago)941.7k↓40%31MITPHPPHP &gt;=5.3.3

Since Jun 23Pushed 11y ago1 watchersCompare

[ Source](https://github.com/legierski/AES)[ Packagist](https://packagist.org/packages/legierski/aes)[ RSS](/packages/legierski-aes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

legierski/AES
=============

[](#legierskiaes)

Perform AES-256 (CBC) encryption/decryption compatible with OpenSSL, CryptoJS, Gibberish AES and possibly other libraries.

Can be used to encrypt data in PHP and decrypt in JavaScript, or vice versa.

Code from here:

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

[](#requirements)

- PHP 5.3.3 or later
- OpenSSL extension for PHP

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

[](#installation)

In `composer.json`:

```
{
    "require": {
        "legierski/aes": "0.1.*"
    }
}
```

Encrypting data
---------------

[](#encrypting-data)

```
$aes = new \Legierski\AES\AES;

$encrypted = $aes->encrypt('Very sensitive data', 'password');

// OpenSSL will truncate rows longer than 76 characters, so let's wrap our encrypted data
$encryptedForOpenSSL = $aes->wrapForOpenSSL($encrypted);
```

Decrypting data
---------------

[](#decrypting-data)

```
$aes = new \Legierski\AES\AES;

$decrypted = $aes->decrypt('U2FsdGVkX1+nnmEfHgoGQpwSPcT+mDZHxhr8XhEsmIvT2JAxsIzsRocO6x1PErrF', 'password');
```

Encrypting/decrypting with OpenSSL
----------------------------------

[](#encryptingdecrypting-with-openssl)

```
$ echo "Very sensitive data" | openssl enc -aes-256-cbc -a -k password

$ echo "U2FsdGVkX1+nnmEfHgoGQpwSPcT+mDZHxhr8XhEsmIvT2JAxsIzsRocO6x1PErrF" | openssl enc -aes-256-cbc -a -d -k password
```

Encrypting/decrypting with CryptoJS
-----------------------------------

[](#encryptingdecrypting-with-cryptojs)

```
var encrypted = CryptoJS.AES.encrypt('Very sensitive data', 'password').toString();

var decrypted = CryptoJS.AES.decrypt('U2FsdGVkX1+nnmEfHgoGQpwSPcT+mDZHxhr8XhEsmIvT2JAxsIzsRocO6x1PErrF', 'password').toString(CryptoJS.enc.Utf8);
```

Encrypting/decrypting with Gibberish AES
----------------------------------------

[](#encryptingdecrypting-with-gibberish-aes)

```
var encrypted = GibberishAES.enc('Very sensitive data', 'password');

var decrypted = GibberishAES.dec('U2FsdGVkX1+nnmEfHgoGQpwSPcT+mDZHxhr8XhEsmIvT2JAxsIzsRocO6x1PErrF', 'password');
```

Testing
-------

[](#testing)

Run unit tests:

```
$ ./vendor/bin/phpunit
```

Test compliance with [PSR2 coding style guide](http://www.php-fig.org/psr/psr-2/):

```
$ ./vendor/bin/phpcs --standard=PSR2 ./src
```

License
-------

[](#license)

The MIT License (MIT)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

4347d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15873a6166559d9055fe14945ccdba520b3160d68b6e33dfd887cbe1b4584cf0?d=identicon)[legierski](/maintainers/legierski)

---

Top Contributors

[![legierski](https://avatars.githubusercontent.com/u/1420343?v=4)](https://github.com/legierski "legierski (2 commits)")

---

Tags

encryptionaesopensslmcryptRijndaeldecryptionCryptoJSGibberish AES

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

961.0M2](/packages/nzo-url-encryptor-bundle)[mmeyer2k/dcrypt

A petite library of encryption functionality for PHP

98727.2k1](/packages/mmeyer2k-dcrypt)[chuyskywalker/phpaes

PHP AES -- Accurate &amp; Fast AES in PHP

356.1k](/packages/chuyskywalker-phpaes)[poly-crypto/poly-crypto

High-level cryptographic functions that are interoperable between NodeJS and PHP 7.1+

127.8k1](/packages/poly-crypto-poly-crypto)

PHPackages © 2026

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