PHPackages                             cycle/entity-behavior-identifier - 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. [Database &amp; ORM](/categories/database)
4. /
5. cycle/entity-behavior-identifier

ActiveLibrary[Database &amp; ORM](/categories/database)

cycle/entity-behavior-identifier
================================

Provides the ability to use ramsey/identifier as various Cycle ORM entity column types

1.x-dev(10mo ago)310[1 issues](https://github.com/cycle/entity-behavior-identifier/issues)[1 PRs](https://github.com/cycle/entity-behavior-identifier/pulls)MITPHPPHP &gt;=8.2CI passing

Since Jul 15Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/cycle/entity-behavior-identifier)[ Packagist](https://packagist.org/packages/cycle/entity-behavior-identifier)[ Docs](https://cycle-orm.dev)[ GitHub Sponsors](https://github.com/sponsors/cycle)[ RSS](/packages/cycle-entity-behavior-identifier/feed)WikiDiscussions 1.x Synced 1mo ago

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

Cycle ORM Entity Behavior Identifier
====================================

[](#cycle-orm-entity-behavior-identifier)

[![Latest Stable Version](https://camo.githubusercontent.com/f8edb90dcd4475839cc4b5fd274312ecb167bc9db45e3b616aaa7f45baf6023a/68747470733a2f2f706f7365722e707567782e6f72672f6379636c652f656e746974792d6265686176696f722d4964656e7469666965722f76657273696f6e)](https://packagist.org/packages/cycle/entity-behavior-identifier)[![Build Status](https://github.com/cycle/entity-behavior-identifier/workflows/build/badge.svg)](https://github.com/cycle/entity-behavior-identifier/actions)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b1badfc5c3ab0cf994f74b81cbe5cfe72f0cacac81590f16f89148fd44a763d5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6379636c652f656e746974792d6265686176696f722d6964656e7469666965722f6261646765732f7175616c6974792d73636f72652e706e673f623d312e78)](https://scrutinizer-ci.com/g/cycle/entity-behavior-identifier/?branch=1.x)[![Codecov](https://camo.githubusercontent.com/0d5691816c38655cb5473a7504817b4c820c16e263071be80add755523062412/68747470733a2f2f636f6465636f762e696f2f67682f6379636c652f656e746974792d6265686176696f722d6964656e7469666965722f67726170682f62616467652e737667)](https://codecov.io/gh/cycle/entity-behavior)[![](https://camo.githubusercontent.com/4442b73a11753b80fdd7b442ddbfaf8383902c8b9ffa66ed1718e8c62e102f2e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646973636f72642d636861742d6d6167656e74612e737667)](https://discord.gg/TFeEmCs)

The package provides the ability to use `ramsey/identifier` as various Cycle ORM entity column types.

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

[](#installation)

> **Note:** Due to a dependency on `ramsey/identifier` this package requires PHP `8.2` or newer.

Install this package as a dependency using Composer.

```
composer require cycle/entity-behavior-identifier
```

Snowflake Examples
------------------

[](#snowflake-examples)

**Snowflake:** A distributed ID generation system developed by Twitter that produces 64-bit unique, sortable identifiers. Each ID encodes a timestamp, machine ID, and sequence number, enabling high-throughput, ordered ID creation suitable for large-scale distributed applications.

> **Note:** Support for Snowflake identifiers will arrive soon, stay tuned.

ULID Examples
-------------

[](#ulid-examples)

**ULID (Universally Unique Lexicographically Sortable Identifier):** A 128-bit identifier designed for high uniqueness and lexicographical sortability. It combines a timestamp component with random data, allowing for ordered IDs that can be generated rapidly and are human-readable, making it ideal for databases and distributed systems.

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Ulid;

#[Entity]
#[Identifier\Ulid(field: 'id')]
class User
{
    #[Column(type: 'ulid', primary: true)]
    private Ulid $id;
}
```

UUID Examples
-------------

[](#uuid-examples)

**UUID Version 1 (Time-based):** Generated using the current timestamp and the MAC address of the computer, ensuring unique identification based on time and hardware.

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Uuid;

#[Entity]
#[Identifier\Uuid1(field: 'id')]
class User
{
    #[Column(type: 'uuid', primary: true)]
    private Uuid $id;
}
```

**UUID Version 2 (DCE Security):** Similar to version 1 but includes a local identifier such as a user ID or group ID, primarily used in DCE security contexts.

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Uuid;

#[Entity]
#[Identifier\Uuid2(field: 'id')]
class User
{
    #[Column(type: 'uuid', primary: true)]
    private Uuid $id;
}
```

**UUID Version 3 (Name-based, MD5):** Created by hashing a namespace identifier and name using MD5, resulting in a deterministic UUID based on input data.

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Uuid;

#[Entity]
#[Identifier\Uuid3(
    field: 'id',
    namespace: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
    name: 'example.com',
)]
class User
{
    #[Column(type: 'uuid', primary: true)]
    private Uuid $id;
}
```

**UUID Version 4 (Random):** Generated entirely from random or pseudo-random numbers, offering high unpredictability and uniqueness.

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Uuid;

#[Entity]
#[Identifier\Uuid4(field: 'id')]
class User
{
    #[Column(type: 'uuid', primary: true)]
    private Uuid $id;
}
```

**UUID Version 5 (Name-based, SHA-1):** Similar to version 3 but uses SHA-1 hashing, providing a different deterministic UUID based on namespace and name.

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Uuid;

#[Entity]
#[Identifier\Uuid5(
    field: 'id',
    namespace: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
    name: 'example.com',
)]
class User
{
    #[Column(type: 'uuid', primary: true)]
    private Uuid $id;
}
```

**UUID Version 6 (Draft/Upcoming):** An experimental or proposed version focused on improving time-based UUIDs with more sortable properties (not yet widely adopted).

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Uuid;

#[Entity]
#[Identifier\Uuid6(field: 'id')]
class User
{
    #[Column(type: 'uuid', primary: true)]
    private Uuid $id;
}
```

**UUID Version 7 (Draft/Upcoming):** A newer proposal designed to incorporate sortable features based on Unix timestamp, enhancing performance in database indexing.

```
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\ORM\Entity\Behavior\Identifier;
use Ramsey\Identifier\Uuid;

#[Entity]
#[Identifier\Uuid7(field: 'id')]
class User
{
    #[Column(type: 'uuid', primary: true)]
    private Uuid $id;
}
```

You can find more information about Entity behavior UUID [here](https://cycle-orm.dev/docs/entity-behaviors-identifier).

License:
--------

[](#license)

The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance55

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 94.4% 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

307d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/796136?v=4)[Anton Tsitou](/maintainers/wolfy-j)[@wolfy-j](https://github.com/wolfy-j)

---

Top Contributors

[![puzzledpolymath](https://avatars.githubusercontent.com/u/162779269?v=4)](https://github.com/puzzledpolymath "puzzledpolymath (17 commits)")[![roxblnfk](https://avatars.githubusercontent.com/u/4152481?v=4)](https://github.com/roxblnfk "roxblnfk (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cycle-entity-behavior-identifier/health.svg)

```
[![Health](https://phpackages.com/badges/cycle-entity-behavior-identifier/health.svg)](https://phpackages.com/packages/cycle-entity-behavior-identifier)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)[usmanhalalit/laracsv

A Laravel package to easily generate CSV files from Eloquent model.

6151.7M4](/packages/usmanhalalit-laracsv)

PHPackages © 2026

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