Skip to content

Releases: visus-io/php-cuid2

6.0.0

26 Dec 12:15
Immutable release. Only release title and notes can be modified.
6.0.0
834c8a1

Choose a tag to compare

What's Changed

⚠️ Breaking Changes

  • Minimum PHP version increased from 8.1 to 8.2
  • Removed markrogoyski/math-php dependency - replaced with pure PHP implementation

✨ Performance & Architecture Improvements

CUID Generation:

  • CUID value now generated in constructor and cached for zero-overhead repeated access
  • Previously computed on-demand, now provides predictable performance characteristics

Fingerprint Refactor:

  • Changed from array-based to binary string storage (SHA3-512 hash)
  • Added singleton protections (__clone, __wakeup) to prevent misuse
  • Platform-specific hostname length constants for Windows/Unix systems
  • Improved documentation and type safety

Counter Improvements:

  • Now uses PHP 8.2's Random\Randomizer with Secure engine
  • Automatic bias-free sampling (eliminates manual rejection sampling)
  • Cleaner, more maintainable implementation

Base Conversion:

  • New Utils class with optimized base36 conversion algorithm
  • Uses intermediate large base (100 million) for efficient arithmetic
  • Pure PHP implementation, zero external dependencies
  • GMP still recommended for optimal performance

📚 Documentation

  • Added comprehensive CONTRIBUTING.md with development guidelines
  • Updated README.md with improved documentation
  • Enhanced inline documentation across core classes

🔧 Maintenance

  • Stronger composer cache key for CI
  • Updated Renovate configuration
  • Dependency updates via Renovate bot

Full Changelog: 5.2.0...6.0.0

5.2.0

07 Oct 12:34
5.2.0
e9603b7

Choose a tag to compare

What's Changed

  • feat: introduce static generate method by @xaevik in #273
  • feat: add isValid method for basic validation by @xaevik in #274

Note

The new Cuid2::isValid() method only guarantees that the value follows CUID2 format, it does not guarantee that it is actually a CUID2.

Full Changelog: 5.1.1...5.2.0

5.1.1

29 Sep 13:06
5.1.1
78549d8

Choose a tag to compare

What's Changed

  • General source code optimizations and cleanups

Full Changelog: 5.1.0...5.1.1

5.1.0

22 Jun 14:54
5.1.0
2298018

Choose a tag to compare

What's Changed

  • Fingerprint will now take environment variables into account when generating a fingerprint.
  • The GMP PHP extension has returned to being optional.
  • The dependency markrogoyski/math-php has been introduced as a viable fallback for when GMP is not available.

Full Changelog: 5.0.0...5.1.0

5.0.0

09 Dec 11:44
5.0.0
019e77d

Choose a tag to compare

What's Changed

  • The PHP extension GMP is now required to prevent precision loss during CUID generation. (#255)

Full Changelog: 4.1.0...5.0.0

4.1.0

14 May 13:29
4.1.0
17c9b30

Choose a tag to compare

What's Changed

  • Fingerprint class has been refactored to align with the implementation in cuid.net
  • Checks implemented in Cuid2 class to ensure that the hashing algorithm sha3-512 is supported, otherwise it'll throw an \Exception

Note: Fingerprint generation no longer relies on $_SERVER variables containing IP addresses. This should alleviate any GDPR/CCPA concerns.

Full Changelog: 4.0.0...4.1.0

4.0.0

19 Aug 21:16
4.0.0
624e982

Choose a tag to compare

What's Changed

  • Change license from Apache-2.0 to MIT

Full Changelog: 3.0.0...4.0.0

3.0.0

11 Aug 16:26
3.0.0
0a422fa

Choose a tag to compare

What's Changed

  • Sets minimum supported version of PHP to 8.1. Use 2.x release if PHP 8.0 support is still required.

Full Changelog: 2.0.0...3.0.0

2.0.0

23 Mar 19:20
2.0.0
907919c

Choose a tag to compare

  • Migrate namespace from Xaevik to Visus to reflect change in ownership.
  • Drop support for PHP 7.4

Full Changelog: 1.7.0...2.0.0