{"id":30213816,"url":"https://github.com/cycle/entity-behavior-identifier","last_synced_at":"2025-10-06T19:14:37.240Z","repository":{"id":304606786,"uuid":"1015538572","full_name":"cycle/entity-behavior-identifier","owner":"cycle","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-10T16:13:49.000Z","size":175,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"1.x","last_synced_at":"2025-08-10T18:13:24.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cycle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"cycle"}},"created_at":"2025-07-07T16:47:21.000Z","updated_at":"2025-07-16T16:43:54.000Z","dependencies_parsed_at":"2025-07-14T08:48:48.021Z","dependency_job_id":"28178f61-c2a2-4e7e-81ee-5434635a0815","html_url":"https://github.com/cycle/entity-behavior-identifier","commit_stats":null,"previous_names":["cycle/entity-behavior-identifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cycle/entity-behavior-identifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fentity-behavior-identifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fentity-behavior-identifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fentity-behavior-identifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fentity-behavior-identifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycle","download_url":"https://codeload.github.com/cycle/entity-behavior-identifier/tar.gz/refs/heads/1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fentity-behavior-identifier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270335902,"owners_count":24566749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-13T23:41:30.510Z","updated_at":"2025-10-06T19:14:32.203Z","avatar_url":"https://github.com/cycle.png","language":"PHP","funding_links":["https://github.com/sponsors/cycle"],"categories":[],"sub_categories":[],"readme":"# Cycle ORM Entity Behavior Identifier\n[![Latest Stable Version](https://poser.pugx.org/cycle/entity-behavior-Identifier/version)](https://packagist.org/packages/cycle/entity-behavior-identifier)\n[![Build Status](https://github.com/cycle/entity-behavior-identifier/workflows/build/badge.svg)](https://github.com/cycle/entity-behavior-identifier/actions)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cycle/entity-behavior-identifier/badges/quality-score.png?b=1.x)](https://scrutinizer-ci.com/g/cycle/entity-behavior-identifier/?branch=1.x)\n[![Codecov](https://codecov.io/gh/cycle/entity-behavior-identifier/graph/badge.svg)](https://codecov.io/gh/cycle/entity-behavior)\n\u003ca href=\"https://discord.gg/TFeEmCs\"\u003e\u003cimg src=\"https://img.shields.io/badge/discord-chat-magenta.svg\"\u003e\u003c/a\u003e\n\nThe package provides the ability to use `ramsey/identifier` as various Cycle ORM entity column types.\n\n## Installation\n\n\u003e **Note:** Due to a dependency on `ramsey/identifier` this package requires PHP `8.2` or newer.\n\nInstall this package as a dependency using Composer.\n\n```bash\ncomposer require cycle/entity-behavior-identifier\n```\n\n## Snowflake Examples\n\n**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.\n\n\u003e **Note:** Support for Snowflake identifiers will arrive soon, stay tuned.\n\n## ULID Examples\n\n**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.\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Ulid;\n\n#[Entity]\n#[Identifier\\Ulid(field: 'id')]\nclass User\n{\n    #[Column(type: 'ulid', primary: true)]\n    private Ulid $id;\n}\n```\n\n## UUID Examples\n\n**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.\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Uuid;\n\n#[Entity]\n#[Identifier\\Uuid1(field: 'id')]\nclass User\n{\n    #[Column(type: 'uuid', primary: true)]\n    private Uuid $id;\n}\n```\n\n**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.\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Uuid;\n\n#[Entity]\n#[Identifier\\Uuid2(field: 'id')]\nclass User\n{\n    #[Column(type: 'uuid', primary: true)]\n    private Uuid $id;\n}\n```\n\n**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.\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Uuid;\n\n#[Entity]\n#[Identifier\\Uuid3(\n    field: 'id',\n    namespace: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',\n    name: 'example.com',\n)]\nclass User\n{\n    #[Column(type: 'uuid', primary: true)]\n    private Uuid $id;\n}\n```\n\n**UUID Version 4 (Random):** Generated entirely from random or pseudo-random numbers, offering high unpredictability and uniqueness.\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Uuid;\n\n#[Entity]\n#[Identifier\\Uuid4(field: 'id')]\nclass User\n{\n    #[Column(type: 'uuid', primary: true)]\n    private Uuid $id;\n}\n```\n\n**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.\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Uuid;\n\n#[Entity]\n#[Identifier\\Uuid5(\n    field: 'id',\n    namespace: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',\n    name: 'example.com',\n)]\nclass User\n{\n    #[Column(type: 'uuid', primary: true)]\n    private Uuid $id;\n}\n```\n\n**UUID Version 6 (Draft/Upcoming):** An experimental or proposed version focused on improving time-based UUIDs with more sortable properties (not yet widely adopted).\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Uuid;\n\n#[Entity]\n#[Identifier\\Uuid6(field: 'id')]\nclass User\n{\n    #[Column(type: 'uuid', primary: true)]\n    private Uuid $id;\n}\n```\n\n**UUID Version 7 (Draft/Upcoming):** A newer proposal designed to incorporate sortable features based on Unix timestamp, enhancing performance in database indexing.\n\n```php\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\nuse Cycle\\ORM\\Entity\\Behavior\\Identifier;\nuse Ramsey\\Identifier\\Uuid;\n\n#[Entity]\n#[Identifier\\Uuid7(field: 'id')]\nclass User\n{\n    #[Column(type: 'uuid', primary: true)]\n    private Uuid $id;\n}\n```\n\nYou can find more information about Entity behavior UUID [here](https://cycle-orm.dev/docs/entity-behaviors-identifier).\n\n## License:\n\nThe MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information.\nMaintained by [Spiral Scout](https://spiralscout.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fentity-behavior-identifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycle%2Fentity-behavior-identifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fentity-behavior-identifier/lists"}