PHPackages                             adbario/php-encrypter - 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. adbario/php-encrypter

ActiveLibrary[Security](/categories/security)

adbario/php-encrypter
=====================

Encryption with AES-256 and HMAC-SHA256

1.0.0(9y ago)107.7k4MITPHPPHP &gt;=5.3

Since Mar 26Pushed 9y ago2 watchersCompare

[ Source](https://github.com/adbario/php-encrypter)[ Packagist](https://packagist.org/packages/adbario/php-encrypter)[ Docs](https://github.com/adbario/php-encrypter)[ RSS](/packages/adbario-php-encrypter/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP Encrypter
=============

[](#php-encrypter)

This project encrypts and decrypts the given value. It uses OpenSSL extension with AES-256 cipher for encryption and HMAC-SHA-256 for hash. The encryption and hash can use different keys.

PHP Encrypter requires PHP 5.3 or higher, OpenSSL and Multibyte String extensions.

### Security Notice

[](#security-notice)

As a reversible operation, encryption is not a secure solution for storing passwords. Always use hashing with salt per user for passwords.

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

[](#installation)

#### With [Composer](https://getcomposer.org/):

[](#with-composer)

```
composer require adbario/php-encrypter

```

#### Manual installation:

[](#manual-installation)

1. Download the latest release
2. Extract the files into your project
3. require\_once '/path/to/php-encrypter/src/Encrypter.php';
4. If your PHP version is lower than 7, also [polyfill for random\_bytes()](https://github.com/paragonie/random_compat) is required

Usage
-----

[](#usage)

Setup the encryption key:

```
$key = '+NeXrQhAEhW}g8gf^y)Up8hAUKpue7wb';
```

**Change the key to your own custom random 32 character string.**

Create a new encrypter instance:

```
$encrypter = new \Adbar\Encrypter($key);
```

If you wish to use a different key for hashing, you can pass it to constructor as a second parameter:

```
$encrypter = new \Adbar\Encrypter($key, $authKey);
```

### Encryption

[](#encryption)

Encrypt a string:

```
$string = 'This is my string to encrypt.';
$encrypted = $encrypter->encryptString($string);
```

Encrypt other variable types with serialization:

```
$array = array('key' => 'value');
$encrypted = $encrypter->encrypt($array);
```

### Decryption

[](#decryption)

Decrypt a string:

```
$string = $encrypter->decryptString($encrypted);
```

Decrypt other variable types with serialization:

```
$array = $encrypter->decrypt($encrypted);
```

License
-------

[](#license)

[MIT license](LICENSE.md)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

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

3386d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22136575?v=4)[Riku Sarkinen](/maintainers/adbario)[@adbario](https://github.com/adbario)

---

Top Contributors

[![adbario](https://avatars.githubusercontent.com/u/22136575?v=4)](https://github.com/adbario "adbario (5 commits)")

---

Tags

securityencryption

### Embed Badge

![Health badge](/badges/adbario-php-encrypter/health.svg)

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

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k465.6M1.5k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k175.2M254](/packages/defuse-php-encryption)[ass/xmlsecurity

The XmlSecurity library is written in PHP for working with XML Encryption and Signatures

955.7M35](/packages/ass-xmlsecurity)[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

971.1M2](/packages/nzo-url-encryptor-bundle)[tilleuls/url-signer-bundle

Create and validate signed URLs with a limited lifetime in Symfony

81369.3k](/packages/tilleuls-url-signer-bundle)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

778.3k1](/packages/ercsctt-laravel-file-encryption)

PHPackages © 2026

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