v4.0.0
Breaking Changes
- Require PHP ^8.3 (dropped 8.2)
- Require Laravel ^11.0|^12.0 (dropped 9, 10)
ConfigParametersis nowfinalwith a private constructorHashIdDTOis now areadonlyclassConfig::checkIfModelClassExist()renamed toConfig::checkIfModelClassExists()HasHashIdRouting::getRouteKey()return type changed fromstringtomixed
Added
HashIdutility class — generic encode/decode without a model (HashId::encode(),HashId::decode(),HashId::buildGenerator())Blueprint::hashId()macro — schema sugar for nullable, unique hash id columns in migrationsHashIdCast— Eloquent cast for transparent hash id attribute storageSerializesHashIdtrait — replaces primary key with hash id intoArray()/toJson()output@hashidBlade directive — XSS-safe hash id output in templatesDecryptsHashIdstrait — auto-decodes hash id inputs to integer keys inFormRequesthashid:encodeArtisan command — encode a key to a hash id via CLIhashid:decodeArtisan command — decode a hash id to its key via CLIValidHashIdvalidation rule — format validation with optional model-specific check (no DB hit)HashIdExistsvalidation rule — database existence check for Hash Ids- Rector with PHP 8.3 target and Laravel rule sets
- Architecture tests (Pest Arch)
- Pest type coverage plugin
- Unified CI workflow with tiered quality gates
Fixed
- Type casts in
Generator::build()preventingTypeErrorwith string config values - Type casts in
Generator::parseHashIDForModel()generic path for strict comparison - Null guard in
Generator::parseHashIDForModel()whenprefix_lengthis-1 HasHashIdRouting::resolveRouteBindingQuery()simplified to usestatic::keyFromHashId()directlyHasHashId::getHashIdRawAttribute()removed redundantgetKey()callHasHashId::keyFromHashId()returns null when decode yields empty array (#25)FindOrByHashIdMixincallback parameter position corrected
Changed
- Test framework migrated from PHPUnit to Pest 4
ConfigParametersconstants are now typed (PHP 8.3 typed constants)ConfigParameters::$parametersstatic property replaced withConfigParameters::PARAMETERSconst array- Larastan upgraded from v2 to v3
- PHPStan
ignoreErrorsmigrated to identifier-based format
Removed
- SonarCloud integration
- Deprecated
.php-cs-fixer.phpconfig (replaced by Pint) - Separate
run-tests.yml,phpstan.yml,pint.ymlworkflows (unified intoci.yml)
Full Changelog: v3.1.1...v4.0.0