Everything on attributes.
5 articles tagged attributes, sorted newest first.
PHP 8.5 Attributes on Constants: A Real Deprecation Path at Last
PHP 8.5 finally lets attributes target global constants, so #[\Deprecated] works on them — and on traits. Here is what actually changed, and what will break if you ship it too early.
Use Closures in Constant Expressions in PHP 8.5
PHP 8.5 finally lets a closure live inside a constant expression — attribute arguments, default values and class constants. The static, no-use restriction is where people trip.
Deprecate Your Own Code with PHP 8.4's #[\Deprecated] Attribute
PHP 8.4's #[\Deprecated] attribute turns invisible docblock deprecations into real runtime warnings that reflection and static analysis can see. Here's how to use it in a Laravel package.
PHP 8.5 #[\NoDiscard]: Stop Silently Ignoring Return Values That Matter
PHP 8.5 ships a new #[\NoDiscard] attribute that warns when you forget to use a function's return value. Here is how to apply it to your own immutable builders — and why (void) is the only safe way to suppress it.
PHP Custom Attributes in Practice: Beyond Laravel's Built-ins
Laravel 13 ships dozens of built-in PHP attributes, but the docs are quiet on building your own. Here are the patterns I use in production for validation, auth, and auto-discovery.