github spatie/laravel-permission 7.0.0

10 hours ago

Modernize codebase for v7

The aim for v7 is to modernize the codebase while keeping the upgrade path easy. Modern PHP/Laravel features, Pest tests, but no big architectural changes. A future v8 could then tackle larger changes and streamline the package more fundamentally.

Version requirements

  • Requires PHP ^8.4 and Laravel ^12.0
  • Test suite uses Pest ^3.0

Service provider

  • Converted to PackageServiceProvider from spatie/laravel-package-tools
  • Removed Lumen support

Class renames

  • Event classes now have an Event suffix (PermissionAttachedPermissionAttachedEvent, etc.)
  • Command classes now have a Command suffix (CacheResetCacheResetCommand, etc.)

Type safety

  • Added return types and parameter types throughout traits, middleware, exceptions, contracts, and commands

Code modernization

  • is_a($this, X::class)$this instanceof X
  • get_class($obj)$obj::class
  • strpos($x, $y) !== falsestr_contains($x, $y)
  • Constructor promotion in WildcardPermission
  • Proper use imports for global classes

Cleanup

  • Removed deprecated clearClassPermissions() method
  • Removed __construct from Wildcard contract
  • Modernized migration stubs

Testing

  • Converted entire test suite from PHPUnit to Pest (#2912)

Full Changelog: 6.24.1...7.0.0

Don't miss a new laravel-permission release

NewReleases is sending notifications on new releases.