Skip to content

v3.13.0

Compare
Choose a tag to compare
@roxblnfk roxblnfk released this 22 May 18:33
· 215 commits to master since this release

New features

1. Introduced LoggerChannel attribute

We are excited to introduce a new feature that enhances the flexibility of the logging component. With the new LoggerChannel attribute, developers can now specify the logger channel directly in the code.

Example Usage:

class SomeService
{
	public function __construct(
	    // Logger with channel `roadrunner` will be injected
		#[LoggerChannel('roadrunner')] public LoggerInterface $logger
	){}
}

This feature allows for better organization and clarity in logging, helping you maintain and debug your application more efficiently.

by @roxblnfk in #1102

2. Added an ability additionally to scan parent classes.

With this update, you can now scan for attributes in parent classes, making your class discovery process more comprehensive and efficient.

Why This Matters

Previously, the tokenizer could only listen to classes where attributes were found. This limitation did not allow for the automatic (convenient) detection of classes by parent attributes and the effective use of the tokenizer cache. With this update, it will also listen to interfaces that the class with the attribute implements and the classes that it extends. This new feature leverages the full power of the tokenizer without the need to scan all classes and handle them manually, ensuring a more efficient and thorough attribute detection process.

Here is a practical example of how to use this feature:

use Spiral\Tokenizer\Attribute\TargetAttribute;

#[TargetAttribute(attribute: MyAttribute::class, scanParents: true)]
class MyListener implements TokenizationListenerInterface
{
    public function listen(\ReflectionClass $class): void
    {
        // Your logic here
    }

    public function finalize(): void
    {
        // Your logic here
    }
}

by @roxblnfk in #1110

Other

  • [spiral/queue] Added an ability to pass headers to the job handler using SyncDriver by @msmakouz in #1107
  • [spiral/router] Added HEAD and OPTIONS HTTP methods to route:list command by @tairau in #1109
  • [spiral/stempler] Fixed bug in a directive parser by @butschster in #1098
  • [spiral/core] Container Proxy classes are generated now with the mixed type in the methods parameters by @msmakouz in #1092
  • [spiral/core] Optimized the StateBinder::hasInjector() method by @anoxia in #1105
  • [spiral/tokenizer] Fixed registration tokenizer scopes via TokenizerBootloader by @butschster in #1093

Full Changelog: 3.12.0...3.13.0