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.1(2mo ago)31231LGPL-3.0-or-laterPHPPHP &gt;=7.3CI passing

Since May 16Pushed 2mo 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 today

READMEChangelog (6)Dependencies (8)Versions (7)Used By (0)

PikaID
======

[](#pikaid)

[![License: LGPL-3.0-or-later](https://camo.githubusercontent.com/7b17128465cb7dbc4f08f00cfcdeb0c586cb208bed53b5a39c84e07d2c5a2b20/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4c47504c2d2d332e302d2d6f722d2d6c617465722d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/7f0037338af137aa8ea57c4cafd6b4cb48b79238fc11d1e40aee1c3951ed06a7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d6d6f6465726e2d3737376262342e737667)](#)

**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.3.

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)

```
