Skip to content

v4.0.0

Choose a tag to compare

@deligoez deligoez released this 02 Mar 23:16
· 7 commits to main since this release

Breaking Changes

  • Require PHP ^8.3 (dropped 8.2)
  • Require Laravel ^11.0|^12.0 (dropped 9, 10)
  • ConfigParameters is now final with a private constructor
  • HashIdDTO is now a readonly class
  • Config::checkIfModelClassExist() renamed to Config::checkIfModelClassExists()
  • HasHashIdRouting::getRouteKey() return type changed from string to mixed

Added

  • HashId utility 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 migrations
  • HashIdCast — Eloquent cast for transparent hash id attribute storage
  • SerializesHashId trait — replaces primary key with hash id in toArray() / toJson() output
  • @hashid Blade directive — XSS-safe hash id output in templates
  • DecryptsHashIds trait — auto-decodes hash id inputs to integer keys in FormRequest
  • hashid:encode Artisan command — encode a key to a hash id via CLI
  • hashid:decode Artisan command — decode a hash id to its key via CLI
  • ValidHashId validation rule — format validation with optional model-specific check (no DB hit)
  • HashIdExists validation 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() preventing TypeError with string config values
  • Type casts in Generator::parseHashIDForModel() generic path for strict comparison
  • Null guard in Generator::parseHashIDForModel() when prefix_length is -1
  • HasHashIdRouting::resolveRouteBindingQuery() simplified to use static::keyFromHashId() directly
  • HasHashId::getHashIdRawAttribute() removed redundant getKey() call
  • HasHashId::keyFromHashId() returns null when decode yields empty array (#25)
  • FindOrByHashIdMixin callback parameter position corrected

Changed

  • Test framework migrated from PHPUnit to Pest 4
  • ConfigParameters constants are now typed (PHP 8.3 typed constants)
  • ConfigParameters::$parameters static property replaced with ConfigParameters::PARAMETERS const array
  • Larastan upgraded from v2 to v3
  • PHPStan ignoreErrors migrated to identifier-based format

Removed

  • SonarCloud integration
  • Deprecated .php-cs-fixer.php config (replaced by Pint)
  • Separate run-tests.yml, phpstan.yml, pint.yml workflows (unified into ci.yml)

Full Changelog: v3.1.1...v4.0.0