Download the PHP package php-architecture-kit/uuid without Composer

On this page you can find all versions of the php package php-architecture-kit/uuid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package uuid

php-architecture-kit/uuid

Provider-agnostic UUID Value Object for PHP applications, designed as a base for domain-specific Entity IDs in DDD architectures.

Features

Installation

You also need at least one UUID provider:

Quick Start

Creating Domain-Specific IDs

Provider Support Matrix

Feature Ramsey Symfony Notes
UUID v1 ✅ ✅ Time-based
UUID v1 + clockSequence ✅ ❌ Ramsey only
UUID v3 ✅ ✅ MD5 hash
UUID v4 ✅ ✅ Random
UUID v5 ✅ ✅ SHA-1 hash
UUID v6 ✅ ✅ Time-ordered (improved v1)
UUID v6 + clockSequence ✅ ❌ Ramsey only
UUID v7 ✅ ✅ Time-ordered + random
UUID v8 ✅ ❌ Custom data
Validation ✅ ✅

Performance

All benchmarks run on PHP 8.2, measuring mode (most frequent execution time).

Overhead Analysis

This library adds a thin abstraction layer over the underlying UUID providers. The table below shows the overhead compared to direct provider usage.

UUID Parsing (fromString)

Operation Direct Ramsey This Library Overhead
With validation 1.23μs 2.27μs +1.04μs (+85%)
Without validation N/A 0.82μs —
Operation Direct Symfony This Library Overhead
With validation 2.87μs 2.68μs -0.19μs (-7%)
Without validation N/A 0.85μs —

UUID Parsing (fromBinary)

Operation Direct Ramsey This Library Overhead
With validation 2.44μs 4.97μs +2.53μs (+104%)
Without validation N/A 2.36μs —
Operation Direct Symfony This Library Overhead
With validation 3.79μs 5.20μs +1.41μs (+37%)
Without validation N/A 2.33μs —

UUID Creation

Version Direct Ramsey This Library Overhead
v1 21.58μs 24.34μs +2.76μs (+13%)
v3 8.46μs 24.90μs +16.44μs (+194%)
v4 5.15μs 6.02μs +0.87μs (+17%)
v5 7.67μs 26.56μs +18.89μs (+246%)
v6 22.03μs 28.14μs +6.11μs (+28%)
v7 7.86μs 9.15μs +1.29μs (+16%)
v8 5.07μs 5.36μs +0.29μs (+6%)
Version Direct Symfony This Library Overhead
v1 5.27μs 11.19μs +5.92μs (+112%)
v3 6.17μs 6.25μs +0.08μs (+1%)
v4 1.81μs 3.04μs +1.23μs (+68%)
v5 6.26μs 9.09μs +2.83μs (+45%)
v6 6.93μs 12.30μs +5.37μs (+77%)
v7 3.81μs 4.65μs +0.84μs (+22%)

Key Insights

  1. Symfony backend is faster for most operations due to simpler implementation
  2. Parsing without validation (fromString($uuid, false)) is ~3x faster than with validation
  3. v4, v7, v8 have minimal overhead (~6-17%) - ideal for most use cases
  4. v3, v5 with Ramsey have higher overhead due to namespace UUID parsing in each call
  5. Autodetect mode selects the best provider automatically with minimal overhead
  6. For hot paths, consider:
    • Using fromString($uuid, false) when UUID is already validated
    • Caching namespace UUIDs for v3/v5 operations
    • Using v4 or v7 for best performance

When Overhead Matters

Use Case Typical Volume Impact
HTTP Request ID 1/request Negligible
Entity IDs 10-100/request Negligible
Batch processing 10,000+/batch ~10-60ms extra
Real-time systems μs-sensitive Consider direct provider

API Reference

Factory Methods

Method Description
Uuid::new() Creates new UUID (defaults to v7)
Uuid::fromString(string $uuid, bool $validate = true) Parse UUID string
Uuid::fromBinary(string $bytes, bool $validate = true) Parse 16-byte binary
Uuid::v1(?ClockInterface $clock, ?int $clockSequence, ?string $nodeIdentifier) Time-based
Uuid::v3(Uuid $namespace, string $name) MD5 hash-based
Uuid::v4() Random
Uuid::v5(Uuid $namespace, string $name) SHA-1 hash-based
Uuid::v6(?ClockInterface $clock, ?int $clockSequence, ?string $nodeIdentifier) Time-ordered
Uuid::v7(?ClockInterface $clock) Unix timestamp + random
Uuid::v8(string $customData) Custom 16-byte data
Uuid::nil() Nil UUID (all zeros)
Uuid::max() Max UUID (all ones)

Instance Methods

Method Description
value(): string Get UUID string
toString(): string Get UUID string
toBinary(): string Get 16-byte binary
getVersion(): int Get UUID version (0-15)
getTime(): ?DateTimeImmutable Get timestamp (v1/v6/v7)
getClockSequence(): ?int Get clock sequence (v1/v6)
getNode(): ?string Get node identifier (v1/v6)
equals(self\|string $other): bool Compare UUIDs
validate(): bool Validate UUID format

Namespace Constants

Source of Truth

RFC 9562 - Universally Unique IDentifiers (UUIDs)

License

MIT


All versions of uuid with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
psr/clock Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-architecture-kit/uuid contains the following files

Loading the files please wait ...