PHPackages                             eloquent/lockbox - 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. eloquent/lockbox

AbandonedArchivedLibrary[Security](/categories/security)

eloquent/lockbox
================

Simple, strong encryption.

0.2.0(12y ago)23174[1 issues](https://github.com/eloquent/lockbox-php/issues)MITPHPPHP &gt;=5.3

Since Aug 25Pushed 12y ago1 watchersCompare

[ Source](https://github.com/eloquent/lockbox-php)[ Packagist](https://packagist.org/packages/eloquent/lockbox)[ Docs](https://github.com/eloquent/lockbox-php)[ RSS](/packages/eloquent-lockbox/feed)WikiDiscussions develop Synced 2w ago

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

Lockbox for PHP
===============

[](#lockbox-for-php)

*Simple, strong encryption.*

[![The most recent stable version is 0.2.0](https://camo.githubusercontent.com/6492d0846640bfad29a5c40400d172fca31fcb837da34e44e9a9cd93f3725d2c/687474703a2f2f696d672e736869656c64732e696f2f3a73656d7665722d302e322e302d79656c6c6f772e737667 "This project uses semantic versioning")](http://semver.org/)[![Current build status image](https://camo.githubusercontent.com/2598dff491ac990eafc33b94b3dd527c10d3b3b60ff149a02076b025cf5e68ad/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f656c6f7175656e742f6c6f636b626f782d7068702f646576656c6f702e737667 "Current build status for the develop branch")](https://travis-ci.org/eloquent/lockbox-php)[![Current coverage status image](https://camo.githubusercontent.com/4d53d621165e71aca0357e43828ec94d1d0df5f87933174e7333bf8aa3f768bb/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f656c6f7175656e742f6c6f636b626f782d7068702f646576656c6f702e737667 "Current test coverage for the develop branch")](https://coveralls.io/r/eloquent/lockbox-php)

Installation and documentation
------------------------------

[](#installation-and-documentation)

- Available as [Composer](http://getcomposer.org/) package [eloquent/lockbox](https://packagist.org/packages/eloquent/lockbox).
- [API documentation](http://lqnt.co/lockbox-php/artifacts/documentation/api/) available.

What is *Lockbox*?
------------------

[](#what-is-lockbox)

*Lockbox* is the simplest possible way to implement strong encryption for use in applications. *Lockbox* uses a combination of well-established technologies to ensure the safety of data. For more information, see the [Lockbox website](http://lqnt.co/lockbox).

Usage
-----

[](#usage)

### Generating and writing keys

[](#generating-and-writing-keys)

```
use Eloquent\Lockbox\Key\Generator\KeyGenerator;
use Eloquent\Lockbox\Key\Persistence\KeyWriter;

$keyGenerator = new KeyGenerator;
$key = $keyGenerator->generateKey();

$keyPath = '/path/to/lockbox.key';
$keyWriter = new KeyWriter;
$keyWriter->writeFile($key, $keyPath);
```

Currently there is no way to generate lockbox keys via the command line, but this feature is planned.

### Encrypting data

[](#encrypting-data)

```
use Eloquent\Lockbox\Encrypter;
use Eloquent\Lockbox\Key\Persistence\KeyReader;

$keyPath = '/path/to/lockbox.key';
$keyReader = new KeyReader;
$key = $keyReader->readFile($keyPath);

$encrypter = new Encrypter;
echo $encrypter->encrypt($key, 'Super secret data.');
```

### Encrypting multiple data packets with the same key

[](#encrypting-multiple-data-packets-with-the-same-key)

*Lockbox* includes 'bound' encrypters that are locked to a particular key, which are convenient for encrypting multiple data packets.

```
use Eloquent\Lockbox\Bound\BoundEncrypter;
use Eloquent\Lockbox\Key\Persistence\KeyReader;

$keyPath = '/path/to/lockbox.key';
$keyReader = new KeyReader;
$key = $keyReader->readFile($keyPath);

$encrypter = new BoundEncrypter($key);

echo $encrypter->encrypt('Super secret data.');
echo $encrypter->encrypt('Extra secret data.');
echo $encrypter->encrypt('Mega secret data.');
```

### Decrypting data

[](#decrypting-data)

```
use Eloquent\Lockbox\Decrypter;
use Eloquent\Lockbox\Key\Persistence\KeyReader;

$keyPath = '/path/to/lockbox.key';
$keyReader = new KeyReader;
$key = $keyReader->readFile($keyPath);

$decrypter = new Decrypter;

$encrypted =
    'AQF_VjJS9sAL75uuUP_HTu9Do_3itIDaHLLXmh_JLOBRqQeZ_hnDwht4WtEkz3io' .
    'iW0WIHb3lANyKqpShyiPcVdj_DbfYiIPEWab8e3vqwEUvoqFFNo';

$result = $decrypter->decrypt($key, $encrypted);
if ($result->isSuccessful()) {
    echo $result->data();
} else {
    echo 'Decryption failed.';
}
```

### Decrypting multiple data packets with the same key

[](#decrypting-multiple-data-packets-with-the-same-key)

*Lockbox* includes 'bound' decrypters that are locked to a particular key, which are convenient for decrypting multiple data packets.

```
use Eloquent\Lockbox\Bound\BoundDecrypter;
use Eloquent\Lockbox\Key\Persistence\KeyReader;

$keyPath = '/path/to/lockbox.key';
$keyReader = new KeyReader;
$key = $keyReader->readFile($keyPath);

$decrypter = new BoundDecrypter($key);

$encrypted = array(
    'AQF_VjJS9sAL75uuUP_HTu9Do_3itIDaHLLXmh_JLOBRqQeZ_hnDwht4WtEkz3io' .
    'iW0WIHb3lANyKqpShyiPcVdj_DbfYiIPEWab8e3vqwEUvoqFFNo',
    'AQH44yTs7va1cDoBpX0xVLqIRow5fs8Jj5-DYDJ1R3YY9udBCexmvDs9BH1qJDjC' .
    'RSqcGriKi_UkL5per1WHwdxWuPq8QsYiBqeC9e9zypl0Xi1QT3s',
    'AQGg0MsYtH0Rboyqssivssupb_GKlBotCpdFtc6WpnMaji8_ZvmGUTRu2DKkxFhA' .
    'dk_s0FWZ7NYFjSDt1puIrr7MlB7owNuR5KhUIj04Can0zDCYjJY',
);

foreach ($encrypted as $string) {
    $result = $decrypter->decrypt($string);
    if ($result->isSuccessful()) {
        echo $result->data();
    } else {
        echo 'Decryption failed.';
    }
}
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~9 days

Total

2

Last Release

4684d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100152?v=4)[Erin](/maintainers/ezzatron)[@ezzatron](https://github.com/ezzatron)

---

Top Contributors

[![ezzatron](https://avatars.githubusercontent.com/u/100152?v=4)](https://github.com/ezzatron "ezzatron (173 commits)")

---

Tags

securityencryptionaesopensslSimplewaystrongtwo

### Embed Badge

![Health badge](/badges/eloquent-lockbox/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k175.2M242](/packages/defuse-php-encryption)[phpseclib/phpseclib

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

5.6k455.2M1.5k](/packages/phpseclib-phpseclib)[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)[mmeyer2k/dcrypt

A petite library of encryption functionality for PHP

98794.6k1](/packages/mmeyer2k-dcrypt)

PHPackages © 2026

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