aarondfrancis/urlcrypt 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aarondfrancis/urlcrypt

最新稳定版本:v0.2.0

Composer 安装命令:

composer require aarondfrancis/urlcrypt

包简介

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

README 文档

README

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 on the topic.

This class is based on the 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

URLcrypt requires PHP >= 5.3.3 as well as the mcrypt PHP extension.

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

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?

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

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

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

aarondfrancis/urlcrypt 适用场景与选型建议

aarondfrancis/urlcrypt 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 50.03k 次下载、GitHub Stars 达 98, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 aarondfrancis/urlcrypt 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aarondfrancis/urlcrypt 我们能提供哪些服务?
定制开发 / 二次开发

基于 aarondfrancis/urlcrypt 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 50.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 100
  • 点击次数: 22
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 98
  • Watchers: 9
  • Forks: 61
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04