PHPackages                             aarondfrancis/urlcrypt - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. aarondfrancis/urlcrypt

Abandoned → [atrapalo/urlcrypt](/?search=atrapalo%2Furlcrypt)Library[Utility &amp; Helpers](/categories/utility)

aarondfrancis/urlcrypt
======================

PHP library to securely encode and decode short pieces of arbitrary binary data in URLs.

v0.2.0(11y ago)9851.5k↓19%231MITPHPPHP &gt;=5.3.3

Since Mar 6Pushed 9y ago9 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

URLcrypt
========

[](#urlcrypt)

Ever wanted to securely transmit (not too long) pieces of arbitrary binary data in a URL? **URLcrypt** makes it easy.

To read more about how it works, check out the [blog post](http://aaronfrancis.com/blog/2013/9/9/encrypting-and-encoding-information-in-urls-with-php) on the topic.

This class is based on the [URLCrypt](https://github.com/madrobby/URLcrypt) gem from Thomas Fuchs.

URLcrypt uses **256-bit AES symmetric encryption** to securely encrypt data, and encodes and decodes **Base 32 strings that can be used directly in URLs**.

This can be used to securely store user ids, download expiration dates and other arbitrary data like that when you access a web application from a place that doesn't have other authentication or persistence mechanisms (like cookies):

- Loading a generated image from your web app in an email
- Links that come with an expiration date (à la S3)
- Mini-apps that don't persist data on the server

**Important**: As a general guideline, URL lengths shouldn't exceed about 2000 characters in length, as URLs longer than that will not work in some browsers and with some (proxy) servers. This limits the amount of data you should store with URLcrypt.

**WORD OF WARNING: THERE IS NO GUARANTEE WHATSOEVER THAT THIS CLASS IS ACTUALLY SECURE AND WORKS. USE AT YOUR OWN RISK.**

Patches are welcome; please include tests!

Requirements
------------

[](#requirements)

URLcrypt requires PHP &gt;= 5.3.3 as well as the mcrypt PHP extension.

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

[](#installation)

You can install URLcrypt via Composer with `composer require aarondfrancis/urlcrypt` or by adding the following to your `composer.json` file:

```
{
	"require": {
		"aarondfrancis/urlcrypt": "0.2.*"
	}
}
```

Usage
-----

[](#usage)

```
use Urlcrypt\Urlcrypt;

// encoding without encryption. (don't use for anything sensitive)
$encoded = Urlcrypt::encode("aaron");		// --> "mfqx2664"
$decoded = Urlcrypt::decode("mfqx2664");	// --> "aaron"

// encrypting and encoding
Urlcrypt::$key = "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3";
$encrypted = Urlcrypt::encrypt("aaron");
		// --> "q0dmt61xkjyylA5mp3gm23khd1kg6w7pzxvd3nzcgb047zx8y581"
$decrypted = Urlcrypt::decrypt("q0dmt61xkjyylA5mp3gm23khd1kg6w7pzxvd3nzcgb047zx8y581")
		// --> "aaron"
```

Note that your key has to be a lower-case hex string.

Why not Base 64?
----------------

[](#why-not-base-64)

URLcrypt uses a modified Base 32 algorithm that doesn't use padding characters, and doesn't use vowels to avoid bad words in the generated string.

Base64 results in ugly URLs, since many characters need to be URL escaped.

Development
-----------

[](#development)

Clone the repository and do a `composer install` in the root directory of the library to install the development dependencies. Run the tests with `phpunit` from the root directory.

License
-------

[](#license)

This library is licensed under the MIT License - see the `COPYING` file for details.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

4091d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/033238953a59b9223a1bde703b5e4254e63c7412195da1cb9de5af44bf53fc0a?d=identicon)[aarondfrancis](/maintainers/aarondfrancis)

---

Top Contributors

[![stesla](https://avatars.githubusercontent.com/u/2293?v=4)](https://github.com/stesla "stesla (21 commits)")[![madrobby](https://avatars.githubusercontent.com/u/3390?v=4)](https://github.com/madrobby "madrobby (20 commits)")[![aarondfrancis](https://avatars.githubusercontent.com/u/881931?v=4)](https://github.com/aarondfrancis "aarondfrancis (6 commits)")[![rkallensee](https://avatars.githubusercontent.com/u/1005893?v=4)](https://github.com/rkallensee "rkallensee (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aarondfrancis-urlcrypt/health.svg)

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

###  Alternatives

[hillholliday/craft-user-manual

Craft User Manual allows developers (or even content editors) to provide CMS documentation using Craft's built-in sections (singles, channels, or structures) to create a `User Manual` or `Help` section directly in the control panel.

8472.1k1](/packages/hillholliday-craft-user-manual)[laravolt/semantic-form

Semantic UI form helpers

5213.0k2](/packages/laravolt-semantic-form)

PHPackages © 2026

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