https://github.com/visus-io/php-cuid2
PHP implementation of collision-resistant ids
https://github.com/visus-io/php-cuid2
cuid cuid-generator php
Last synced: 2 months ago
JSON representation
PHP implementation of collision-resistant ids
- Host: GitHub
- URL: https://github.com/visus-io/php-cuid2
- Owner: visus-io
- License: mit
- Created: 2023-01-13T20:11:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-10T19:37:54.000Z (3 months ago)
- Last Synced: 2025-03-29T22:05:43.897Z (2 months ago)
- Topics: cuid, cuid-generator, php
- Language: PHP
- Homepage:
- Size: 435 KB
- Stars: 31
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# visus/cuid2
[](https://github.com/visus-io/php-cuid2/actions/workflows/ci.yaml)
[](https://sonarcloud.io/summary/overall?id=visus%3Aphp-cuid2)
[](https://sonarcloud.io/summary/overall?id=visus%3Aphp-cuid2)
[](https://sonarcloud.io/summary/overall?id=visus%3Aphp-cuid2)
[](https://packagist.org/packages/visus/cuid2)

A PHP implementation of collision-resistant ids. You can read more about CUIDs from the [official project website](https://github.com/paralleldrive/cuid2).
## Getting Started
You can install visus/cuid2 as a [composer package](https://packagist.org/packages/visus/cuid2):
> [!IMPORTANT]
> The PHP extension [GMP](https://www.php.net/manual/en/intro.gmp.php) is required in order to use this library.```shell
composer require visus/cuid2
```## Quick Example
```php
toString(); // apr5hhh4ox45krsg9gycbs9k// new (with custom length)
$cuid = new Visus\Cuid2\Cuid2(10);
echo $cuid; // pekw02xwsd
```