PHPackages                             gogh-idawoodjee/shortcode - 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. gogh-idawoodjee/shortcode

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gogh-idawoodjee/shortcode
=========================

Encode integers and UUIDs to short, URL-safe Base62 strings and back.

v1.0.0(1mo ago)02MITPHPPHP ^8.2

Since May 26Pushed 1mo agoCompare

[ Source](https://github.com/gogh-idawoodjee/shortcode)[ Packagist](https://packagist.org/packages/gogh-idawoodjee/shortcode)[ RSS](/packages/gogh-idawoodjee-shortcode/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

ShortCode
=========

[](#shortcode)

Encode integers and UUIDs to short, URL-safe Base62 strings and back.

Turn `550e8400-e29b-41d4-a716-446655440000` into `5mSYFjfBLkNseKP0tQ8y0w` and back again losslessly.

EncodingCharactersUUID lengthHex (raw UUID)0-9, a-f32 charsBase64A-Z, a-z, 0-9, +, /22 chars (needs padding/escaping)**Base62****A-Z, a-z, 0-9****~22 chars (URL-safe, no escaping)**Base62 gives you near-optimal compression while staying alphanumeric — no `+`, `/`, `=`, or `%`-encoding needed.

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

[](#installation)

```
composer require gogh-idawoodjee/shortcode
```

Requires PHP 8.2+ and the `bcmath` extension.

Usage
-----

[](#usage)

### Integers

[](#integers)

```
use GoghIdawoodjee\ShortCode\ShortCode;

ShortCode::encode(123456);    // "W7E"
ShortCode::decode('W7E');     // 123456
```

### UUIDs

[](#uuids)

```
$uuid = '550e8400-e29b-41d4-a716-446655440000';

$short = ShortCode::encodeUuid($uuid);  // "5mSYFjfBLkNseKP0tQ8y0w"
$back  = ShortCode::decodeUuid($short); // "550e8400-e29b-41d4-a716-446655440000"
```

UUIDs with or without dashes are both accepted. The output is always alphanumeric so it's safe for URLs, filenames, and QR codes.

### Laravel Facade

[](#laravel-facade)

A Laravel facade is included and auto-discovered — no manual registration needed.

```
use GoghIdawoodjee\ShortCode\Facades\ShortCode;

ShortCode::encodeUuid($uuid);
ShortCode::decodeUuid($code);
```

### Error Handling

[](#error-handling)

All methods throw `InvalidArgumentException` on bad input:

```
ShortCode::encode(-1);           // negative number
ShortCode::decode('abc!');       // invalid character
ShortCode::encodeUuid('nope');   // not a valid UUID
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance88

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

59d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/103516145?v=4)[Ismail Dawoodje - Gogh Solutions](/maintainers/gogh-idawoodjee)[@gogh-idawoodjee](https://github.com/gogh-idawoodjee)

---

Top Contributors

[![outofjam](https://avatars.githubusercontent.com/u/6641797?v=4)](https://github.com/outofjam "outofjam (1 commits)")

---

Tags

uuidshort urlbase62encodershortcode

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/gogh-idawoodjee-shortcode/health.svg)

```
[![Health](https://phpackages.com/badges/gogh-idawoodjee-shortcode/health.svg)](https://phpackages.com/packages/gogh-idawoodjee-shortcode)
```

###  Alternatives

[ramsey/uuid

A PHP library for generating and working with universally unique identifiers (UUIDs).

12.6k745.0M4.1k](/packages/ramsey-uuid)[symfony/polyfill-uuid

Symfony polyfill for uuid functions

687372.1M93](/packages/symfony-polyfill-uuid)[symfony/uid

Provides an object-oriented API to generate and represent UIDs

608316.3M1.4k](/packages/symfony-uid)[webpatser/laravel-uuid

Laravel integration for webpatser/uuid - High-performance drop-in UUID replacements (15% faster than Ramsey). Provides Str macros, HasUuids trait, facades, and casts. RFC 4122/9562 compliant.

1.8k17.9M141](/packages/webpatser-laravel-uuid)[pascaldevink/shortuuid

PHP 7.4+ library that generates concise, unambiguous, URL-safe UUIDs

5941.9M16](/packages/pascaldevink-shortuuid)[tuupola/base62

Base62 encoder and decoder for arbitrary data

2064.5M41](/packages/tuupola-base62)

PHPackages © 2026

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