Download the PHP package philiprehberger/php-uuid-tools without Composer

On this page you can find all versions of the php package philiprehberger/php-uuid-tools. 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 php-uuid-tools

PHP UUID Tools

Tests Latest Version on Packagist Last updated

UUID v4, v5, and v7 generation, ULID support, short ID encoding, and ordered UUIDs for database indexing.

Requirements

Installation

Usage

Generate UUID v4

Generate UUID v7

Time-ordered UUIDs with millisecond precision, ideal for database primary keys:

Generate UUID v5

Deterministic namespace-based UUIDs using SHA-1 hashing:

ULID

Generate ULIDs (Universally Unique Lexicographically Sortable Identifiers):

Short IDs

Encode UUIDs as compact Base62 strings (~22 characters):

Validate a UUID

Extract Version

Binary Conversion

Convert between UUID strings and 16-byte binary for compact storage:

Ordered UUIDs

Reorder UUID fields for optimal database index performance. Puts the most-significant time bits first so UUIDs sort chronologically:

Batch Generation

Generate multiple UUIDs at once:

Comparison

Nil UUID

API

Method Description
Uuid::v4(): string Generate a random UUID v4
Uuid::v5(string $namespace, string $name): string Generate a deterministic UUID v5 (SHA-1)
Uuid::v7(): string Generate a time-ordered UUID v7
Uuid::isValid(string $uuid): bool Validate a UUID string (any version)
Uuid::validateBatch(array $uuids): array Return indices of invalid UUIDs in a list
Uuid::version(string $uuid): ?int Extract the version number (null if invalid)
Uuid::toBytes(string $uuid): string Convert UUID to 16-byte binary
Uuid::fromBytes(string $bytes): string Convert 16-byte binary to UUID string
Uuid::toOrdered(string $uuid): string Reorder UUID for database index performance
Uuid::fromOrdered(string $ordered): string Reverse an ordered UUID to standard format
Uuid::equals(string $a, string $b): bool Case-insensitive UUID equality check
Uuid::compareTo(string $a, string $b): int Lexicographic comparison (-1, 0, 1) for sorting
Uuid::batch(int $count, int $version = 4): array Generate multiple UUIDs at once
Uuid::nil(): string Return the nil UUID (all zeros)
Uuid::ulid(): string Generate a ULID
Uuid::isValidUlid(string $ulid): bool Validate a ULID string
Uuid::toShortId(string $uuid): string Encode UUID as Base62 short ID
Uuid::fromShortId(string $shortId): string Decode Base62 short ID to UUID
Ulid::generate(): string Generate a new ULID
Ulid::isValid(string $ulid): bool Validate a ULID string
Ulid::toUuid(string $ulid): string Convert ULID to UUID format
Ulid::fromUuid(string $uuid): string Convert UUID to ULID format
Ulid::timestamp(string $ulid): int Extract Unix timestamp (ms) from ULID
Ulid::toDateTime(string $ulid, ?\DateTimeZone $tz = null): \DateTimeImmutable Decode ULID timestamp into a DateTimeImmutable (UTC default)
ShortId::encode(string $uuid): string Encode UUID as Base62 short ID
ShortId::decode(string $shortId): string Decode Base62 short ID to UUID

Development

Support

If you find this project useful:

Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

License

MIT


All versions of php-uuid-tools with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 philiprehberger/php-uuid-tools contains the following files

Loading the files please wait ...