PHPackages                             rafrsr/crypto - 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. rafrsr/crypto

ActiveLibrary[Security](/categories/security)

rafrsr/crypto
=============

Easy encrypt and decrypt strings in PHP.

2.1.4(6y ago)331.1k↓50%2MITPHPPHP &gt;=5.4

Since Dec 23Pushed 6y ago1 watchersCompare

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

READMEChangelog (9)Dependencies (3)Versions (10)Used By (2)

Crypto
======

[](#crypto)

[![Build Status](https://camo.githubusercontent.com/27d3f5f3919e525a13e0b7f58ec72b8936fda472bc2690cf8b42c7df0545e10a/68747470733a2f2f7472617669732d63692e6f72672f7261667273722f63727970746f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rafrsr/crypto)[![Coverage Status](https://camo.githubusercontent.com/5dda592de3354960e7c8bc3a046321fe7daadc9986181bc3e9886f6e611e4e4c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7261667273722f63727970746f2f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/rafrsr/crypto?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/24f5d9985f8dd56eee58c730d099ea955ec9460a7bd59e61ebf99d438075b351/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f63727970746f2f76657273696f6e)](https://packagist.org/packages/rafrsr/crypto)[![Latest Unstable Version](https://camo.githubusercontent.com/aedef90890080bef65956feecb4d3929d19c95eee568b57b9bab89c3b1bacac0/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f63727970746f2f762f756e737461626c65)](//packagist.org/packages/rafrsr/crypto)[![Total Downloads](https://camo.githubusercontent.com/21997118347b9ddf59378ec6bb24e81d580bacaebd407cdf83ede4c871fd00ce/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f63727970746f2f646f776e6c6f616473)](https://packagist.org/packages/rafrsr/crypto)[![License](https://camo.githubusercontent.com/6e935b3d85676871fdd584ea11d93b14076c4172bc3552696fa3c86c8230edcd/68747470733a2f2f706f7365722e707567782e6f72672f7261667273722f63727970746f2f6c6963656e7365)](https://packagist.org/packages/rafrsr/crypto)

Easy encrypt and decrypt strings in PHP.

Features
--------

[](#features)

- Easy usage `Crypto::build('secretKey')->encrypt('secret message')`
- Support most populars MCRYPT algorithms
- Encryption verification through the method `isEncrypted($data)`
- Prevent double encryption/decryption

Usage
-----

[](#usage)

```
use Rafrsr\Crypto\Crypto;

$encryptor = Crypto::build('JH83UN177772JJASHGAGG38UABASDSD');
//$encryptor = Crypto::build('JH83UN177772JJASHGAGG38UABASDSD', MCRYPT_RIJNDAEL_128); //using specific algorithm

$secret = $encryptor->encrypt('This is a secret message');

if ($encryptor->isEncrypted($secret)) {
    echo 'The messages is encrypted';
}

$notSecret = $encryptor->decrypt($secret);

if (!$encryptor->isEncrypted($notSecret)) {
    echo 'The message is not encrypted';
}
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~170 days

Recently: every ~0 days

Total

9

Last Release

2440d ago

Major Versions

1.0.0 → 2.0.02015-12-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a2b6fe4cdd0f7970b78769f972884c46759925b8bfe9814e47a2799b6439de7?d=identicon)[rafrsr](/maintainers/rafrsr)

---

Top Contributors

[![rafrsr](https://avatars.githubusercontent.com/u/7094012?v=4)](https://github.com/rafrsr "rafrsr (24 commits)")[![yceruto](https://avatars.githubusercontent.com/u/2028198?v=4)](https://github.com/yceruto "yceruto (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rafrsr-crypto/health.svg)

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

###  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)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)

PHPackages © 2026

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