Universally Unique Lexicographically Sortable Identifier ported to PHP

1.3.1 2024-11-07 04:23 UTC

README

Universally Unique Lexicographically Sortable Identifier ported to PHP

PHP Composer

Tests borrowed from .NET port
Original idea borrowed from JS

License AGPL

Requirements

PHP7.4+

Usage:

composer require lewiscowles/ulid

Tests:

To generate the coverage report xdebug extension must be enabled for your PHP

Unit-test CLI

php vendor/bin/phpunit --coverage-html ./reports/ --whitelist src

Mutation testing with infection

php vendor/bin/infection

PHPStan

php vendor/bin/phpstan analyse src -l max

Jenkins pipeline step for testing

    stage('Run Unit Tests in PHP') {
        dir('ulid') {
            sh 'php vendor/bin/phpunit --coverage-html ./reports/ --whitelist src'
        }
        publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'ulid/reports', reportFiles: 'index.html', reportName: 'PHPUnit Coverage'])
    }

Got an idea?

Create an issue, a PR, both (if possible) 😸