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

ActiveLibrary[Security](/categories/security)

hemiframe/php-aes
=================

PHP class for encrypt and decrypt data with AES algorithm

1.2.1(6y ago)1030.3k↓22.2%3MITPHPPHP &gt;=7.1

Since Dec 25Pushed 6y ago1 watchersCompare

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

READMEChangelog (2)DependenciesVersions (3)Used By (0)

PHP class for encrypt and decrypt data with AES algorithm
=========================================================

[](#php-class-for-encrypt-and-decrypt-data-with-aes-algorithm)

Supports
--------

[](#supports)

- custom iv
- auto generate iv
- encode and decode data

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

[](#requirements)

PHP &gt;= 7.1

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

[](#installation)

Enter in composer.json

```
{
    "require": {
        "hemiframe/php-aes": "~1.2"
    }
}
```

or run in console: `php composer.phar require hemiframe/php-aes`

Example
-------

[](#example)

```
require_once('vendor/autoload.php');

$aes = new \HemiFrame\Lib\AES();
$aes->setKey("testkey");
$aes->setData("testdata");

$ivString = $aes->generateIv();
$aes->setIv($ivString);

$encryptedString = $aes->encrypt();
$aes->setData($encryptedString);
$decryptedString = $aes->decrypt();

echo "Available methods: " . implode(",", \HemiFrame\Lib\AES::getAvailableMethods()) . "" . PHP_EOL;
echo "IV string: " . $ivString . "" . PHP_EOL;
echo "Encrypted string: " . $encryptedString . "" . PHP_EOL;
echo "Decrypted string: " . $decryptedString . "" . PHP_EOL;
```

Documentation
-------------

[](#documentation)

### Methods

[](#methods)

```
/**
 * Get encrypt/decrypt key
 * @return string|null
 */
public function getKey(): string

/**
 * Return encoded or decoded string
 * @return mixed
 */
public function getData();

/**
 * Get selected cipher method
 * @return string
 */
public function getMethod(): string

/**
 * Get available cipher methods
 * @return array
 */
public function getAvailableMethods(bool $aliases = false): array

/**
 * Gets selected iv string
 * @return string
 */
public function getIv(): string

/**
 * Generate a iv string for selected method
 * @return string|bool
 */
public function generateIv();

/**
 * Gets the cipher iv length
 * @return int|bool
 */
public function getIvLength();

/**
 * Set encrypt/decrypt key
 * @param string $key
 * @return $this
 * @throws \InvalidArgumentException
 */
public function setKey(string $key): self

/**
 * Set encrypt/decrypt method
 * @param string $method
 * @return $this
 * @throws \InvalidArgumentException
 */
public function setMethod(string $method);

/**
 * Set iv string
 * @param string $iv
 * @return $this
 * @throws \InvalidArgumentException
 */
public function setIv(string $iv): self

/**
 * Set encrypt/decrypt data
 * @param mixed $data
 * @return $this
 * @throws \InvalidArgumentException
 */
public function setData($data): self

/**
 * Returns the encrypted string on success or FALSE on failure.
 * @return string|bool
 * @throws \InvalidArgumentException
 */
public function encrypt();

/**
 * The decrypted string on success or FALSE on failure.
 * @return mixed
 * @throws \InvalidArgumentException
 */
public function decrypt();
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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

Every ~826 days

Total

2

Last Release

2240d ago

PHP version history (2 changes)1.1.0PHP &gt;=7.0

1.2.1PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3735861?v=4)[Martin Bratvanov](/maintainers/heminei)[@heminei](https://github.com/heminei)

---

Top Contributors

[![heminei](https://avatars.githubusercontent.com/u/3735861?v=4)](https://github.com/heminei "heminei (11 commits)")

---

Tags

phpaesencryptdecryptopenssl

### Embed Badge

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

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

###  Alternatives

[miladrahimi/phpcrypt

Encryption, decryption, and hashing tools for PHP projects

3171.5k2](/packages/miladrahimi-phpcrypt)[poly-crypto/poly-crypto

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

127.8k1](/packages/poly-crypto-poly-crypto)[mpyw/easycrypt

A class that provides simple interface for decryptable encryption.

234.7k](/packages/mpyw-easycrypt)

PHPackages © 2026

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