Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
License
cycle/entity-behavior-identifier
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The package provides the ability to useramsey/identifier as various Cycle ORM entity column types.
Note: Due to a dependency on
ramsey/identifierthis package requires PHP8.2or newer.
Install this package as a dependency using Composer.
composer require cycle/entity-behavior-identifier
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 (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.
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Ulid;#[Entity]#[Identifier\Ulid(field:'id')]class User{ #[Column(type:'ulid', primary:true)]privateUlid$id;}
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.
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Uuid;#[Entity]#[Identifier\Uuid1(field:'id')]class User{ #[Column(type:'uuid', primary:true)]privateUuid$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.
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Uuid;#[Entity]#[Identifier\Uuid2(field:'id')]class User{ #[Column(type:'uuid', primary:true)]privateUuid$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.
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Uuid;#[Entity]#[Identifier\Uuid3( field:'id', namespace:'6ba7b810-9dad-11d1-80b4-00c04fd430c8', name:'example.com',)]class User{ #[Column(type:'uuid', primary:true)]privateUuid$id;}
UUID Version 4 (Random): Generated entirely from random or pseudo-random numbers, offering high unpredictability and uniqueness.
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Uuid;#[Entity]#[Identifier\Uuid4(field:'id')]class User{ #[Column(type:'uuid', primary:true)]privateUuid$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.
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Uuid;#[Entity]#[Identifier\Uuid5( field:'id', namespace:'6ba7b810-9dad-11d1-80b4-00c04fd430c8', name:'example.com',)]class User{ #[Column(type:'uuid', primary:true)]privateUuid$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).
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Uuid;#[Entity]#[Identifier\Uuid6(field:'id')]class User{ #[Column(type:'uuid', primary:true)]privateUuid$id;}
UUID Version 7 (Draft/Upcoming): A newer proposal designed to incorporate sortable features based on Unix timestamp, enhancing performance in database indexing.
useCycle\Annotated\Annotation\Column;useCycle\Annotated\Annotation\Entity;useCycle\ORM\Entity\Behavior\Identifier;useRamsey\Identifier\Uuid;#[Entity]#[Identifier\Uuid7(field:'id')]class User{ #[Column(type:'uuid', primary:true)]privateUuid$id;}
You can find more information about Entity behavior UUIDhere.
The MIT License (MIT). Please seeLICENSE for more information.Maintained bySpiral Scout.
About
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.
