PHPackages                             kotchuprik/php-short-id - 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. kotchuprik/php-short-id

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

kotchuprik/php-short-id
=======================

Yet another Short ID generator. The library help you generate short id like youtube, vimeo, bit.ly, etc.

1.1(10y ago)3054.4k—0%10MITPHP

Since May 8Pushed 10y ago2 watchersCompare

[ Source](https://github.com/kotchuprik/php-short-id)[ Packagist](https://packagist.org/packages/kotchuprik/php-short-id)[ RSS](/packages/kotchuprik-php-short-id/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

PHP Short ID creator
====================

[](#php-short-id-creator)

The library help you generate short id like youtube, vimeo, bit.ly, etc. Short generation (creation) based on numerical ID.

Simple scenarios of using
-------------------------

[](#simple-scenarios-of-using)

```
require('vendor/autoload.php');

$shortId = new \kotchuprik\short_id\ShortId();
```

### Creating short ID for a record from in a database

[](#creating-short-id-for-a-record-from-in-a-database)

1. when an app created a record in an your database with ID 424242
2. $shortId-&gt;encode(424242) encodes it to 'bLTs'
3. you updated the record for ID 424242 and set short\_id of the record to 'bLTs'

```
$id = $shortId->encode(422424);     // $id will be 'bLTs'

// or with $neededLength = 6
$id = $shortId->encode(422424, 6);  // $id will be 'babMwC'
```

### Searching record in a database

[](#searching-record-in-a-database)

1. when someone requests rLHWfKd
2. $shortId-&gt;decode('rLHWfKd') decodes it to 424242
3. you found the record for ID 424242 in an your database

```
$id = $shortId->decode('bLTs');      // $id will be 424242

// or with $neededLength = 6
$id = $shortId->decode('babMwC', 6); // $id will be 424242
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~321 days

Total

2

Last Release

3697d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5764b62d1883e2d0b0a733646c2dbc220cd825d62d7f33c8c5d571b62516c3c?d=identicon)[kotchuprik](/maintainers/kotchuprik)

---

Top Contributors

[![chuprik](https://avatars.githubusercontent.com/u/802946?v=4)](https://github.com/chuprik "chuprik (7 commits)")

### Embed Badge

![Health badge](/badges/kotchuprik-php-short-id/health.svg)

```
[![Health](https://phpackages.com/badges/kotchuprik-php-short-id/health.svg)](https://phpackages.com/packages/kotchuprik-php-short-id)
```

###  Alternatives

[maurymmarques/minify-plugin

A CakePHP plugin that facilitates the use of PHP Minify with CakePHP

595.2k](/packages/maurymmarques-minify-plugin)[imi/magento2-store-switch-all-store-views

This module makes all store views available in the store switcher, regardless of their store or website.

1824.6k](/packages/imi-magento2-store-switch-all-store-views)[elegantly/laravel-referrer

Remember User Origin

122.8k](/packages/elegantly-laravel-referrer)

PHPackages © 2026

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