Releases: ray-di/Ray.Aop
2.17.0
What's Changed
- Enable PHP 8.4 compat by @koriym in #220
- Add phpdoc type annotations for psalm by @koriym in #221
- Update Demo using Aspect class by @koriym in #222
- Organizing comments and unnecessary files, etc by @koriym in #224
- Extract PECL code from Aspect to PeclAspect by @koriym in #223
- Binding multiple interceptors with multiple bindings in PECL AOP by @koriym in #225
- Add stability section to README files by @koriym in #226
- Supports method parameter attributes by @koriym in #227
Full Changelog: 2.16.2...2.16.3
2.16.2
What's Changed
- Bug with annotated with matcher by @koriym in #219
- Update Aspect.php by @denise-kao in #218
New Contributors
- @denise-kao made their first contribution in #218
Full Changelog: 2.16.1...2.16.2
2.16.1
What's Changed
- Update Technical Information by @koriym in #215
- Add PHP class diagram HTML page by @koriym in #216
- Fix an issue where the same class would not compile in multiple contexts by @koriym in #217 See
https://github.com/koriym/issue/tree/ray-aop-217-aop-class-in-context
Full Changelog: 2.16.0...2.16.1
2.16.0
Ray.Aop 2.16 "Tanabata" Release Notes
This version brings significant changes to the API, simplifying usage and improving integration with the new PECL extension.
Major Changes
New Aspect Class
The most significant change is the introduction of the Aspect
class, which simplifies the configuration process:
use Ray\Aop\Aspect;
use Ray\Aop\Matcher;
$aspect = new Aspect();
$aspect->bind(
(new Matcher())->any(),
(new Matcher())->annotatedWith(NotOnWeekends::class),
[new WeekendBlocker()]
);
$billing = $aspect->newInstance(RealBillingService::class);
echo $billing->chargeOrder(); // Interceptors applied
This replaces the previous approach using Pointcut
, Bind
, and Weaver
classes:
// Old approach (2.0.0 to pre-2.16.0)
$pointcut = new Pointcut(
(new Matcher())->any(),
(new Matcher())->annotatedWith(NotOnWeekends::class),
[new WeekendBlocker()]
);
$bind = (new Bind)->bind(RealBillingService::class, [$pointcut]);
$billing = (new Weaver($bind, $tmpDir))->newInstance(RealBillingService::class, []);
PECL Extension Integration
Ray.Aop 2.16 seamlessly integrates with the new PECL extension. When the extension is installed, you can use the weave
method:
$aspect = new Aspect();
$aspect->bind(
(new Matcher())->any(),
(new Matcher())->annotatedWith(NotOnWeekends::class),
[new WeekendBlocker()]
);
$aspect->weave(__DIR__ . '/src'); // Weave the aspects
$billing = new RealBillingService();
echo $billing->chargeOrder(); // Interceptors applied
This applies aspects to all classes in a directory, allowing you to use the normal new
keyword for instantiation.
Changes
- The
Pointcut
,Bind
, andWeaver
classes are no longer used directly. Instead, use the newAspect
class. - The
newInstance
method is now part of theAspect
class, notWeaver
.
Additional Notes
- The PECL extension is optional.
- Existing interceptors and matchers should continue to work without modifications.
We believe these changes will make Ray.Aop easier to use and more powerful. As always, we appreciate your feedback and contributions!
What's Changed
- Add PHP class diagram by @koriym in #213
- PECL extension support and introduce newly refined main class "Aspect" by @koriym in #214
Full Changelog: 2.15.2...2.16.0
2.15.2
What's Changed
- Support enum in attribute arguments by @apple-x-co in #212
Enumerations can now be used for attribute arguments as shown below!
enum FruitEnum
{
case Apple;
case Orange;
case Grape;
}
#[Attribute(Attribute::TARGET_METHOD)]
final class FruitEnum
{
public function __construct(
public readonly FruitEnum $fruit1,
public readonly FruitEnum $fruit2,
) {
}
}
#[AttrFoo(fruit1: FruitEnum::Apple, fruit2: FruitEnum::Orange)]
public function methodFoo() {}
Full Changelog: 2.15.1...2.15.2
2.15.1
2.15.0
2.14.0
2.13.1
What's Changed
- Update license copyright year(s) by @github-actions in #198
- Bump php parser to ^4.13.2 by @NaokiTsuchiya in #199
Full Changelog: 2.13.0...2.13.1
2.13.0
What's Changed
Full Changelog: 2.12.4...2.13.0