Version 3.0.0 raises the PHP requirement. The public API is unchanged from 2.0.1.
PHP 8.6
composer.json now requires "php": "^8.6". PHP 8.5 is no longer supported. On PHP 8.5, stay on 2.x.
composer require webpatser/uuid:^3.0
The 3.0.0 changelog states that src/ was reviewed for PHP 8.6 features and needed no source changes, so behavior matches 2.0.1.
Changes since 2.0.1
| Area | Change |
|---|---|
| Requirement | PHP ^8.6, was ^8.5 |
| Dev dependency | pestphp/pest ^5.0, was Pest 4 (Pest 4 does not install on PHP 8.6) |
| CI | Runs on PHP 8.6; composer audit runs without --no-dev |
| Public API | No change |
Changes that arrived in 2.x
If you come from 1.x, these 2.0.0 and 2.0.1 changes also apply.
isSqlServerFormat() is removed
2.0.0 removed isSqlServerFormat(). It never worked as a format check and behaved like validate(). Replace calls with Uuid::validate():
// 1.x$ok = Uuid::isSqlServerFormat($value); // 2.x and 3.x$ok = Uuid::validate($value);
importFromSqlServer(), toSqlServer() and toSqlServerBinary() remain, see SQL Server.
#[\NoDiscard]
All factory and query methods carry #[\NoDiscard]. A call whose result is ignored now raises a warning. Use the value, or cast the call to (void) when you mean to discard it:
Uuid::validate($input); // Warning: result ignored$valid = Uuid::validate($input); // Fine
Stricter input handling
2.0.1 hardened validate(), compare() and the constructor against invalid input. compare() returns false when either value is not a UUID, including two identical invalid strings.
Other 2.0.0 changes
mintName()throws instead of returning null on an unexpected hash algorithm.- The test suite moved from PHPUnit to Pest.
examples/benchmark.phpwas added, see Performance.
Upgrade checklist
- Run PHP 8.6.
- Run
composer require webpatser/uuid:^3.0. - Replace any
isSqlServerFormat()call withvalidate(). - Use the return value of every factory and query call, or cast to
(void). - Run your tests.