PHPackages                             affinity4/cipher - 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. affinity4/cipher

ActiveLibrary[Security](/categories/security)

affinity4/cipher
================

Cipher encrypt/decrypt. Encrypt and decrypt private strings. Useful if you need to store a string as a hash but need to see it as plain text also. DO NOT USE FOR PASSWORD AUTHENTICATION!

2.0.0(4y ago)0382MITPHPPHP &gt;=7.4

Since Apr 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/affinity4/cipher)[ Packagist](https://packagist.org/packages/affinity4/cipher)[ RSS](/packages/affinity4-cipher/feed)WikiDiscussions master Synced 4w ago

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

Affinity4 Cipher
================

[](#affinity4-cipher)

Encrypt and decrypt private strings. Useful if you need to store a string as a hash but need to see it as plain text also.

**DO NOT USE FOR PASSWORD AUTHENTICATION!**

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

[](#installation)

### Composer

[](#composer)

```
composer require affinity4/cipher
```

Usage
-----

[](#usage)

```
// Used by both excrypt and decrypt methods, so should be available globally
// Perhaps as an environment variable
$key = 'b1f1e6225cb2b6d0230b16125e45ca63';
$str = 'my secret';

$encrypted = \Affinity4\Cipher\Cipher::encrypt($str, $key); // piqwpeiqep12801aqwie0248quqjowq==
$decrypted = \Affinity4\Cipher\Cipher::decrypt($encrypted, $key); // my secret
```

Licence
-------

[](#licence)

MIT 2018 Luke Watts

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

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

Total

2

Last Release

1542d ago

Major Versions

1.0.0 → 2.0.02022-05-25

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

2.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8245712?v=4)[Affinity4](/maintainers/Affinity4)[@affinity4](https://github.com/affinity4)

---

Top Contributors

[![lukewatts](https://avatars.githubusercontent.com/u/4622166?v=4)](https://github.com/lukewatts "lukewatts (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/affinity4-cipher/health.svg)

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

###  Alternatives

[phpids/phpids

PHPIDS (PHP-Intrusion Detection System) is a simple to use, well structured, fast and state-of-the-art security layer for your PHP based web application

791150.0k2](/packages/phpids-phpids)[paragonie/ecc

PHP Elliptic Curve Cryptography library

25866.3k44](/packages/paragonie-ecc)[nicobleiler/php-passphrase

Passphrase generator with Laravel integration, inspired by Bitwarden. Uses the EFF long word list by default with support for custom wordlists.

4912.6k](/packages/nicobleiler-php-passphrase)[dwgebler/encryption

Encryption wrapper for PHP using libsodium — simple API for symmetric and asymmetric encryption, password hashing, digital signing, and message authentication.

317.5k](/packages/dwgebler-encryption)

PHPackages © 2026

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