PHPackages                             pikaid/pikaid-php - 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. pikaid/pikaid-php

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

pikaid/pikaid-php
=================

Small · Sortable · Secure IDs

1.1.0(8mo ago)2631MITPHPPHP &gt;=7.3

Since May 16Pushed 6mo ago2 watchersCompare

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

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

PikaID
======

[](#pikaid)

 [![Static Badge](https://camo.githubusercontent.com/20ced0e3486121f760ec8774262f0870d9b7c03653f35e90d7dfba0be8917589/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50696b6149442d2532305048502d626c75653f7374796c653d666f722d7468652d6261646765266c6f676f3d706870)](https://camo.githubusercontent.com/20ced0e3486121f760ec8774262f0870d9b7c03653f35e90d7dfba0be8917589/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50696b6149442d2532305048502d626c75653f7374796c653d666f722d7468652d6261646765266c6f676f3d706870) [![Static Badge](https://camo.githubusercontent.com/c4dffee2a5f58075a98f3d7c1017aa729b511a40bfb9b5353e6481dacb6bd788/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f556e697175652d253230494425323047656e657261746f722d677265656e3f7374796c653d666f722d7468652d6261646765266c6f676f3d686173686e6f6465)](https://camo.githubusercontent.com/c4dffee2a5f58075a98f3d7c1017aa729b511a40bfb9b5353e6481dacb6bd788/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f556e697175652d253230494425323047656e657261746f722d677265656e3f7374796c653d666f722d7468652d6261646765266c6f676f3d686173686e6f6465) [![Static Badge](https://camo.githubusercontent.com/791fe4a71cb264a4e11c3ae05ad723bbc048d71a0fff66adfc3efd3f0e7217c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f536f727461626c652d2532304368726f6e6f6c6f676963616c2d6f72616e67653f7374796c653d666f722d7468652d6261646765266c6f676f3d636c6f636b696679)](https://camo.githubusercontent.com/791fe4a71cb264a4e11c3ae05ad723bbc048d71a0fff66adfc3efd3f0e7217c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f536f727461626c652d2532304368726f6e6f6c6f676963616c2d6f72616e67653f7374796c653d666f722d7468652d6261646765266c6f676f3d636c6f636b696679) [![Static Badge](https://camo.githubusercontent.com/5741d1ae11f8f189557fb500ed549026ae8707f76cd786423ada4d3b886683ba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5365637572652d25323043727970746f253230456e74726f70792d7265643f7374796c653d666f722d7468652d6261646765266c6f676f3d736563757269747973636f726563617264)](https://camo.githubusercontent.com/5741d1ae11f8f189557fb500ed549026ae8707f76cd786423ada4d3b886683ba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5365637572652d25323043727970746f253230456e74726f70792d7265643f7374796c653d666f722d7468652d6261646765266c6f676f3d736563757269747973636f726563617264) [![Static Badge](https://camo.githubusercontent.com/ddb3c6fc68ddb0327a4045275285ce5a8dccd4316f4e109b42d5a151ed8a37e9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d2532304d49542d626c61636b3f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/ddb3c6fc68ddb0327a4045275285ce5a8dccd4316f4e109b42d5a151ed8a37e9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d2532304d49542d626c61636b3f7374796c653d666f722d7468652d6261646765)

**PikaID** is a tiny PHP library that creates **unique, short, and sortable IDs** —
a modern alternative to UUIDs for your databases, APIs, and distributed systems.

💡 Example Use Case
------------------

[](#-example-use-case)

Imagine you’re building a **web app** where users can post messages or create orders.
Each new item needs a **unique ID** so your system can recognize it.

If you use normal numbers (`1, 2, 3…`), you can have **conflicts** when several servers create data at the same time.
If you use UUIDs, you get **long, messy IDs** that are hard to read and don’t follow creation time.

**PikaID solves this:**

- Every new ID is **unique**, even if many servers create them at once.
- IDs are **short**, so they look clean in URLs or logs.
- They are **time-ordered**, so when you list data, the newest appears last or first automatically.

You can use PikaID to:

- Identify **users**, **orders**, **invoices**, or **API resources**.
- Name **uploaded files** safely.
- Tag **events** or **logs** across distributed systems.

> **In short:** PikaID gives you clean, safe, and sortable IDs for anything that needs a unique reference.

 [![pikaid](https://raw.githubusercontent.com/pikaid/pikaid-php/refs/heads/main/logo.png)](https://raw.githubusercontent.com/pikaid/pikaid-php/refs/heads/main/logo.png)

Pikaid (PHP)
============

[](#pikaid-php)

**Small · Sortable · Secure ID generator**

This is the **official PHP implementation.** Fully compliant with v1.0.1.

Pikaid is a **26-character, lowercase Base36 identifier**, composed of:

- **7-character timestamp** (seconds since epoch)
- **19-character cryptographically secure randomness**

It’s a **modern, compact alternative** to UUID and ULID:

- Lexicographically sortable
- Collision-resistant
- Compact binary form (`BINARY(17)`)

[![pikaid structure](https://raw.githubusercontent.com/pikaid/pikaid-php/refs/heads/main/structure.png)](https://raw.githubusercontent.com/pikaid/pikaid-php/refs/heads/main/structure.png)

---

📚 Specifications &amp; Benchmarks
---------------------------------

[](#-specifications--benchmarks)

See the full technical specs and benchmarks at [**pikaid/pikaid-specs**](https://github.com/pikaid/pikaid-specs)

---

⚙️ Requirements
---------------

[](#️-requirements)

- PHP **7.4+** (PHP 8 recommended)
- `ext-gmp` *(recommended for best performance)* or `ext-bcmath` *(optional)*
- If neither extension is installed, a pure-PHP fallback is used.

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require pikaid/pikaid-php
```

Include Composer's autoloader in your project:

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

---

🚀 Basic Usage
-------------

[](#-basic-usage)

```
