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(3y ago)0337MITPHPPHP &gt;=7.4

Since Apr 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/affinity4/cipher)[ Packagist](https://packagist.org/packages/affinity4/cipher)[ RSS](/packages/affinity4-cipher/feed)WikiDiscussions master Synced 3d 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 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

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

1450d 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://www.gravatar.com/avatar/6eda764179ed00e7d50099142dc56015a0a5a44542d6df9bb80fe087418efceb?d=identicon)[Affinity4](/maintainers/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

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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