PHPackages                             crisu83/shortid - 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. crisu83/shortid

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

crisu83/shortid
===============

1.1.0(8y ago)15125.2k↓36.3%4[1 issues](https://github.com/crisu83/php-shortid/issues)6BSD-3-ClausePHPPHP &gt;=5.4.0

Since Apr 22Pushed 8y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (5)Versions (3)Used By (6)

php-shortid
===========

[](#php-shortid)

[![Build Status](https://camo.githubusercontent.com/88080e17969406562947634e999028b9931828f7c604cdeb039149bd1e881591/68747470733a2f2f7472617669732d63692e6f72672f637269737538332f7068702d73686f727469642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/crisu83/php-shortid)[![Code Climate](https://camo.githubusercontent.com/bb5e506be384159ca30eff0008c944db866c267e8f0a1e314729c73bde5deab9/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f637269737538332f7068702d73686f727469642f6261646765732f6770612e737667)](https://codeclimate.com/github/crisu83/php-shortid)[![Total Downloads](https://camo.githubusercontent.com/7beae0f7c5f16494d963ee8cbf2e9028006ba38b59d671d29b43eac0ac639bf7/68747470733a2f2f706f7365722e707567782e6f72672f637269737538332f73686f727469642f646f776e6c6f616473)](https://packagist.org/packages/crisu83/shortid) [![Latest Unstable Version](https://camo.githubusercontent.com/6c4a1264363bb190c8e460bcac83dca8241186c321edf3a21311509b789a60f7/68747470733a2f2f706f7365722e707567782e6f72672f637269737538332f73686f727469642f762f756e737461626c652e737667)](https://packagist.org/packages/crisu83/shortid) [![License](https://camo.githubusercontent.com/1937f6c6b9b81d6b69257166fd308f1109fb599c21d6211971bb9b1e3cd9e185/68747470733a2f2f706f7365722e707567782e6f72672f637269737538332f73686f727469642f6c6963656e73652e737667)](https://packagist.org/packages/crisu83/shortid)

Library for generating short non-sequential unique identifiers in PHP.

Why do I want this?
-------------------

[](#why-do-i-want-this)

This library was created as a more convenient alternative to other unique identifer generators such as UUID. While the identifiers generated may not be truly unique, they are more convenient because of their short form and unique enough to be used as e.g. entity ids, database identifiers, url-shorteners and much more.

Disclaimer
----------

[](#disclaimer)

Please note that if your project requires the identifiers to be truly unique you should verify the uniqueness yourself. This is by design to both increase the performance and reduce the memory consumption when generating identifiers.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist crisu83/shortid "*"

```

or add

```
"crisu83/shortid": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Example usage:

```
