PHPackages                             ricbarbo/simple-php-encryptor - 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. ricbarbo/simple-php-encryptor

ActiveLibrary[Security](/categories/security)

ricbarbo/simple-php-encryptor
=============================

Simple PHP Encryption

14PHP

Since Aug 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/snake03/simple-php-encryptor)[ Packagist](https://packagist.org/packages/ricbarbo/simple-php-encryptor)[ RSS](/packages/ricbarbo-simple-php-encryptor/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Simple PHP Encryption Static Class.

Encrypt and decrypt any message using two secret phrases.

The main advantage over the built-in encryption methods is that the encrypted message has the same length of the original message, so it's often very short and it's ideal for creating authentication keys or access tokens and passing them with GET or POST requests.

This algorithm is very basic stuff, use it at your own risk.

Examples
--------

[](#examples)

Encrypt any message. It will return a string of the same length of the sentence encrypted

> Encryption::encrypt("My Secret Sentence")

Decrypt a message previously encrypted

> Encryption::decrypt("EaNQhIuWVH6enZ+dh6ipl6GliFfSp4GknpqFhc6lsbbLyYN+")

Sign a message. It will ouput a 20 characters long string.

> Encryption::sign("Andrew")

Detect if the signature of the message is valid. It return a boolean, true if it's valid, false otherwise.

> Encryption::hasValidSignature("Andrew", "aoi28CA91ncuaF910s1E")

### Example: Token generation

[](#example-token-generation)

In the *examples* folder you will find a simple Token generation case. If you want to create a simple access token for a user, you may want to grab the user's id and the current timestamp, sign them together, encrypt them and pass this generated token to the user.

When the user append this token to a request, you can decrypt it, verify the signature, check if it's still valid (in the example the token has a 1 week validity) and use user's id.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4792196?v=4)[Riccardo Barbotti](/maintainers/snake03)[@snake03](https://github.com/snake03)

---

Top Contributors

[![snake03](https://avatars.githubusercontent.com/u/4792196?v=4)](https://github.com/snake03 "snake03 (5 commits)")

### Embed Badge

![Health badge](/badges/ricbarbo-simple-php-encryptor/health.svg)

```
[![Health](https://phpackages.com/badges/ricbarbo-simple-php-encryptor/health.svg)](https://phpackages.com/packages/ricbarbo-simple-php-encryptor)
```

###  Alternatives

[mews/purifier

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

2.0k18.0M134](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24772.0k35](/packages/paragonie-ecc)[fof/recaptcha

Increase your forum's security with Google reCAPTCHA

1436.9k](/packages/fof-recaptcha)

PHPackages © 2026

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