Short code encoding
encode, decode and hex variants reach the default connection through __call().
Hashids / PHP + Rust
Short code encoding, multiple connections and six framework adapters on a core with no framework dependency.
The core only resolves multiple connections and builds instances, with no framework dependency; connection() builds and caches on demand, and __call() forwards to the default connection.
The six framework adapters total about 490 lines and only handle container binding and config loading; the Laravel Facade and config format match vinkla/hashids.
A rounded square teal creature with an antenna, a # badge on its chest, and a speech bubble showing the encoded result 3kTMd.
Turn numeric IDs into short codes.Six groups around one framework-free core.
encode, decode and hex variants reach the default connection through __call().
Configure Salt and Length per connection; connection() switches, builds once and caches.
Native wiring for Laravel, Webman, ThinkPHP, Hyperf, Yii 2 and Yii 3.
Facade, container bindings and config shape match vinkla/hashids for a smooth swap.
The core only needs hashids/hashids; new HashidsManager works standalone.
The README and architecture diagrams ship in 12 translations.
Beyond PHP, the same short ID capability is available as a native Rust implementation.
Native Rust short IDs
Native hashids with official test vectors, zero default deps and eight Rust web frameworks.
From API alignment to real framework contract tests, every step has a release.
Add Yii 2 and Yii 3 adapters and docs in 12 languages.
Add real Laravel contract tests and split two conflicting CI jobs.
Add end-to-end Install contract tests to close the last stub gap.
Fix Webman and Hyperf config bugs; add a vinkla-aligned API.
Click an image to enlarge.
Install first, then run a minimal example.
composer require erikwang2013/hashidsuse Erikwang2013\Hashids\HashidsFactory;
use Erikwang2013\Hashids\HashidsManager;
$manager = new HashidsManager(
require __DIR__ . '/config/hashids.php',
new HashidsFactory()
);
$hash = $manager->encode(1, 2, 3);
$ids = $manager->decode($hash);cargo add hashids-rustuse std::sync::Arc;
use hashids::{Config, ConnectionConfig, Guard, HashidsManager};
let manager = Arc::new(HashidsManager::new(
Config::new().connection("main", ConnectionConfig::new().salt("this is my salt")),
));
let hashids = Guard::from_manager(manager)?;
let hash = hashids.encode(&[1, 2, 3]);
let ids = hashids.decode(&hash);Hover and it changes mood.