visus/cuid2

This package is abandoned and no longer maintained. No replacement package was suggested.

A PHP library for generating collision-resistant ids (CUIDs).

Installs: 182 693

Dependents: 2

Suggesters: 0

Security: 0

Stars: 15

Watchers: 2

Forks: 2

4.0.0 2023-08-19 21:14 UTC

This package is auto-updated.

Last update: 2024-01-01 12:40:53 UTC


README

GitHub Workflow Status (with event) Code Quality Coverage

PHP Version Packagist Downloads GitHub

A PHP implementation of collision-resistant ids. You can read more about CUIDs from the official project website.

Getting Started

You can install visus/cuid2 as a composer package:

composer require visus/cuid2

Quick Example

<?php
require_once 'vendor/autoload.php';

// new (default length of 24)
$cuid = new Visus\Cuid2\Cuid2();

// implicit casting
echo $cuid; // hw8kkckkgwkk0oo0gkw0o8sg

// explicit casting
echo $cuid->toString(); // hw8kkckkgwkk0oo0gkw0o8sg

// new (with custom length)
$cuid = new Visus\Cuid2\Cuid2(10);
echo $cuid; // psk8844ck4