uuidfactory/uuidfactory-php

PHP client for UUIDFactory API – generate and validate UUIDs online

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

pkg:composer/uuidfactory/uuidfactory-php

1.0.0 2026-02-01 14:27 UTC

This package is not auto-updated.

Last update: 2026-02-02 12:44:40 UTC


README

PHP client for UUIDFactory API – generate and validate UUIDs online

UUIDFactory website | API Documentation | Online Validator | Online Generator

Overview

uuidfactory-php is the official PHP client for the UUIDFactory API.
Easily generate and validate UUIDs in your PHP projects. Supports UUID versions v1, v4, v7, GUID, batch generation, and batch validation, with seamless integration with the UUIDFactory online tools.

Key Features:

  • Generate UUID v1, v4, v7, and GUID programmatically
  • Validate single UUIDs or multiple UUIDs at once
  • Generate multiple UUIDs at once (batch generation)
  • Simple, lightweight PHP client using cURL
  • Works with UUIDFactory API

Requirements

  • PHP 7.4+
  • ext-curl
  • ext-json

Installation

Install via Composer:

composer require uuidfactory/uuidfactory-php

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use UuidFactory\UuidFactoryClient;

$client = new UuidFactoryClient();

// Generate a UUID v4
$uuid = $client->generateV4();
echo "Generated UUID v4: " . $uuid . "\n";

// Generate multiple UUIDs
$uuids = $client->generateMultiple('v4', 5);
print_r($uuids);

// Validate a single UUID
$result = $client->validate($uuids[0]);
echo "Is single UUID valid? " . ($result['status'] === 'valid' ? 'yes' : 'no') . "\n";

// Validate multiple UUIDs at once
$validationResults = $client->validateMultiple($uuids);
print_r($validationResults);

Available Methods

Method Description
generateV1() Generate UUID version 1
generateV4() Generate UUID version 4 (random)
generateV7() Generate UUID version 7
generateGUID() Generate a GUID
generateMultiple(string $type, int $count) Generate multiple UUIDs of the given type (v1, v4, v7, guid)
validate(string $uuid) Validate if a string is a valid UUID; returns `['uuid' => ..., 'status' => 'valid'
validateMultiple(array $uuids) Validate multiple UUIDs at once

Examples

Check the examples/ folder for ready-to-run PHP scripts:

  • examples/basic.php – Generate and validate single UUIDs
  • examples/batch.php – Generate and validate multiple UUIDs at once

Run from project root after composer install:

php examples/basic.php
php examples/batch.php

Uruchomienie w Dockerze

W katalogu projektu:

docker compose run --rm php composer install
docker compose run --rm php php examples/basic.php
docker compose run --rm php php examples/batch.php

Use Cases

  • Quick UUID generation for PHP backend projects
  • Validating single or multiple UUIDs before database insertion
  • Generating multiple UUIDs for bulk operations
  • Integration in Laravel, Symfony, or plain PHP apps

Links & References

License

This project is licensed under the MIT License.