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

ActiveLibrary[Security](/categories/security)

codezero/encrypter
==================

Encrypt and decrypt strings in PHP.

2.0.2(6y ago)394.4k↓17.6%11MITPHPPHP &gt;=5.6.0

Since Mar 28Pushed 6y ago2 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (5)Used By (1)

Encrypter
=========

[](#encrypter)

![GitHub release](https://camo.githubusercontent.com/83f1f2c164a497f783d5b4c67ad0459e4c9c6c04495d372f42c5a82fd1337c0b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f64657a65726f2d62652f656e637279707465722e737667)![License](https://camo.githubusercontent.com/3ca093a9a67d48a6602a6f34d933b010fbbcdd5639a414a455858cb98934ac05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f64657a65726f2f656e637279707465722e737667)[![Build Status](https://camo.githubusercontent.com/407a8e18f9d956d283fe282073351661ee8cdf7842092a4860a8116a1d82dcce/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f64657a65726f2d62652f656e637279707465722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/codezero-be/encrypter/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/99f299ff33e8b6868210b2780ca370ccdd212fa176b5018b2f0c96dd909088d0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f64657a65726f2d62652f656e637279707465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/codezero-be/encrypter/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f326090474f72d59509703b695190a7d4c3e0b7dc19ac2e7a8c2ddad7182299a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f64657a65726f2d62652f656e637279707465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/codezero-be/encrypter/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/65342cc666b746adc63d49b23b6ad72693d3082117c09d29288ab4c40d46e833/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64657a65726f2f656e637279707465722e737667)](https://packagist.org/packages/codezero/encrypter)

[![ko-fi](https://camo.githubusercontent.com/1fedf764fa06114b797ee53e7506df10880abed6766f854202d758df1707969d/68747470733a2f2f7777772e6b6f2d66692e636f6d2f696d672f676974687562627574746f6e5f736d2e737667)](https://ko-fi.com/R6R3UQ8V)

#### Encrypt and decrypt strings in PHP.

[](#encrypt-and-decrypt-strings-in-php)

This package includes an adapter for [Laravel](http://laravel.com/)'s `Encrypter` that adheres to my `Encrypter` interface. This can be used in vanilla PHP. Other implementations might be added in the future.

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

[](#installation)

Install this package through Composer:

```
composer require codezero/encrypter
```

Vanilla PHP Implementation
--------------------------

[](#vanilla-php-implementation)

Autoload the vendor classes:

```
require_once 'vendor/autoload.php'; // Path may vary
```

Choose a key. You will need the same key that was used to encrypt a string, to decrypt it.

```
$key = 'my secret key';
```

And then use the `DefaultEncrypter` implementation:

```
$encrypter = new \CodeZero\Encrypter\DefaultEncrypter($key);
```

Usage
-----

[](#usage)

### Encrypt a string

[](#encrypt-a-string)

```
$encrypted = $encrypter->encrypt('some string');
```

### Decrypt an encrypted string

[](#decrypt-an-encrypted-string)

```
try {
    $decrypted = $encrypter->decrypt($encrypted);
} catch (\CodeZero\Encrypter\DecryptException $exception) {
    // Decryption failed...
}
```

Testing
-------

[](#testing)

```
$ composer run test

```

Security
--------

[](#security)

If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

2426d ago

Major Versions

1.0.0 → 2.0.02016-11-30

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

2.0.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e17b7a892452367dfb0e5c55bf04844a16bb781f356f50019332d4b9a476ec6?d=identicon)[codezero](/maintainers/codezero)

---

Top Contributors

[![ivanvermeyen](https://avatars.githubusercontent.com/u/3598622?v=4)](https://github.com/ivanvermeyen "ivanvermeyen (14 commits)")

---

Tags

encrypterlaravelphpvanilla-phpphplaravelencryptionencrypt

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sbamtr/laravel-source-encrypter

Laravel Source Encrypter

58545.6k](/packages/sbamtr-laravel-source-encrypter)[dolphiq/laravel-aescrypt

AES encrypt and decrypt Eloquent attributes inspired by elocryptfive

171.7k](/packages/dolphiq-laravel-aescrypt)[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)
