visus / cuid2
A PHP library for generating collision-resistant ids (CUIDs).
Installs: 334 649
Dependents: 2
Suggesters: 0
Security: 0
Stars: 26
Watchers: 3
Forks: 2
Open Issues: 1
Requires
- php: ^8.1
Requires (Dev)
- ext-ctype: *
- ergebnis/composer-normalize: ^2.29
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.7
- vimeo/psalm: ^5.4
Suggests
- ext-gmp: *
README
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