NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #2485 most downloaded on Packagist
An aspect oriented framework
Latest stable
2.20.2
Last release 2 months ago
03 Sep 2026
Release timing varies
gaps range from 2 weeks to 9 months
Most releases are documented
notes for 53 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
92 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
Write weaved class files atomically so concurrent processes never require a half-written file (regression of #137 since 2.15.0).
require a half-written file (regression of #137 since 2.15.0). (#266)Proxy codegen: the implements-list regex no longer swallows a same-line class body brace, and multi-line implements lists no longer lose every interfa
AopCode::GENERATION bump. (#264)CompilationFailedException) for class declarations that put the body brace on the same line as the implements list, or split the implements list over multiple lines (which dropped every interface after the first). Generated proxies are invalidated via an AopCode::GENERATION bump, so stale cached proxies regenerate once after upgrade. (#264)Your coding agent can read these notes before it upgrades. Set up the MCP server →
Proxy dispatch is now a direct parent::method(...) first-class callable (no double dispatch through the proxy); intercepted-call overhead roughly halv
parent::method(...) first-class callable (no double dispatch through the proxy); intercepted-call overhead roughly halved. Generated proxies are invalidated via AopCode::GENERATION — existing script dirs regenerate once after upgrade (stale files are ignored, not loaded). (#260)newInstance path: cache weaved class names, instantiate with new $class(...$args) instead of reflection, and match attributes without instantiating them during bind. (#259)is_a, aligned with #255). Methods annotated with a subclass attribute may get a different interceptor order than before (they were previously bound only in the default phase). (#259)// comment listing bound interceptor short class names (self-documenting generated code; no runtime cost). (#262)Compiler::compile() now (re)emits the weaved class file even when the class is already declared in the process but the file is missing, so a compile pipeline that cleans and recompiles produces complete output for runtime loaders that resolve weaved classes by name. (#261)getThis(). Such nested calls are now intercepted normally (previously interception state was corrupted). (#260)$1-style sequences (preg_replace backreference bug in AopCode::insert()). (#260)getAnnotations()/getAnnotation(), so a broken attribute constructor on an unrelated method cannot fatal bind(). (#259)Weaver serialization excludes the in-process weaved-class cache so a restored Weaver in another process reloads class files instead of assuming FQNs are already defined. (#259)AopCode::INTERCEPT_STATEMENT public const, _intercept(), _isAspect; AopCode::resolveInterceptTrait() is now private. (#260)getAnnotation() now matches child classes by default using ReflectionAttribute::IS_INSTANCEOF (#254, #255)
getAnnotation() now matches child classes by default using ReflectionAttribute::IS_INSTANCEOF (#254, #255)This restores the instanceof matching behavior that was broken in 2.18.0.
Backward-compatible deprecation stubs provided in src-deprecated/
$aspect->bind() + newInstance() insteadsrc-deprecated/@readonly annotations with native readonly keyword (#249)
AopPostfixClassName, Compiler, AnnotatedMatcher, ReflectiveMethodInvocation, InterceptTraitStateExisting code using AspectPecl or PeclDispatcher will receive a clear LogicException with migration instructions instead of "Class not found" errors.
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.18.0...2.19.0
$aspect->bind() + newInstance() insteadsrc-deprecated/@readonly annotations with native readonly keyword (#249)Supports AOP targeting PHP 8.2 readonly classes by @koriym in https://github.com/ray-di/Ray.Aop/pull/238
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.17.2...2.18.0
Rolled back to the state of v2.17.1 to address a breaking change introduced in v2.17.2.
This release is deprecated for breaking BC. Reverted in 2.17.3.
This release is deprecated for breaking BC. Reverted in 2.17.3.
~## What's Changed~ ~* Add support for readonly class in PHP 8.2 by @ngmy in https://github.com/ray-di/Ray.Aop/pull/236~
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.17.1...2.17.2
This release is deprecated for breaking BC. Reverted in 2.17.3.
remove extra <?php by @hanahiroAze in https://github.com/ray-di/Ray.Aop/pull/228
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.17.0...2.17.1
<?php (#228)Enable PHP 8.4 compat by @koriym in https://github.com/ray-di/Ray.Aop/pull/220
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.16.2...2.16.3
Bug with annotated with matcher by @koriym in https://github.com/ray-di/Ray.Aop/pull/219
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.16.1...2.16.2
Update Technical Information by @koriym in https://github.com/ray-di/Ray.Aop/pull/215
This version brings significant changes to the API, simplifying usage and improving integration with the new PECL extension.
This version brings significant changes to the API, simplifying usage and improving integration with the new PECL extension.
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, []);
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.
Pointcut, Bind, and Weaver classes are no longer used directly. Instead, use the new Aspect class.newInstance method is now part of the Aspect class, not Weaver.We believe these changes will make Ray.Aop easier to use and more powerful. As always, we appreciate your feedback and contributions!
<img src="https://github.com/ray-di/Ray.Aop/assets/529021/0bc60345-0aba-4ad5-8957-a71ef45722b3" alt="Tanabata BEAR.Sunday" width="200px">
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.15.2...2.16.0
Aspect class - Simplifies API and improves PECL extension integrationweave() methodAspect class instead of Pointcut, Bind, and WeavernewInstance method is now part of Aspect class, not WeaverBefore (2.0.0 to 2.15.x):
$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, []);
After (2.16.0+):
$aspect = new Aspect();
$aspect->bind(
(new Matcher())->any(),
(new Matcher())->annotatedWith(NotOnWeekends::class),
[new WeekendBlocker()]
);
$billing = $aspect->newInstance(RealBillingService::class);
Support enum in attribute arguments by @apple-x-co in https://github.com/ray-di/Ray.Aop/pull/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: https://github.com/ray-di/Ray.Aop/compare/2.15.1...2.15.2
Fixed to not make mixed nullable by @koriym in https://github.com/ray-di/Ray.Aop/pull/211
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.15.0...2.15.1
Enable PHP 8.3 compat by @koriym in https://github.com/ray-di/Ray.Aop/pull/204
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.14.0...2.15.0
<img width="600" alt="image" src="https://github.com/ray-di/Ray.Aop/assets/529021/a6e772ba-01dc-4b47-970d-a9d27bea588d">
福島・塩野崎の大桜
Soothe psalm by @koriym in https://github.com/ray-di/Ray.Aop/pull/200
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.13.1...2.14.0
Update license copyright year(s) by @github-actions in https://github.com/ray-di/Ray.Aop/pull/198
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.13.0...2.13.1
Enable PHP 8.2 compat by @koriym in https://github.com/ray-di/Ray.Aop/pull/196
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.12.4...2.13.0
Improve compile performace by @koriym in https://github.com/ray-di/Ray.Aop/pull/192 https://github.com/ray-di/Ray.Aop/pull/195
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.12.3...2.12.4
PHP 8.2-alpha Support by @koriym in https://github.com/ray-di/Ray.Aop/pull/190
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.12.2...2.12.3
Support PHP 7.2 by @koriym in https://github.com/ray-di/Ray.Aop/pull/189
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.12.1...2.12.2
Fix wrong compiled method of parent by @NaokiTsuchiya in https://github.com/ray-di/Ray.Aop/pull/188
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.12.0...2.12.1
Parent method intercept by @NaokiTsuchiya in https://github.com/ray-di/Ray.Aop/pull/181
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.11.0...2.12.0
template annotation into ReflectionMethod::getAnnotation by @sasezaki in https://github.com/ray-di/Ray.Aop/pull/179
Full Changelog: https://github.com/ray-di/Ray.Aop/compare/2.10.6...2.11.0
* Fix the serialize issue #178 * Cleanup
Thanks for reporting the issue! @momospnr
Thanks for reporting the issue! @momospnr
* Fix #172 getNamedArguments()
getNamedArguments()Nothing published for this version
Thanks to the team at bengo4 for pointing out the problem! @amashigeseiji @sambo
Thanks to the team at bengo4 for pointing out the problem! @amashigeseiji @sambo
Nothing published for this version
Add Service Locator only for the annotation/attribute reader.
Forward compatible with PHP 8 #148
Nothing published for this version
Nothing published for this version
Generic notation in PHPDOC (PHPStan, Psalm level max) #144
Fix annotated generics #141 Thanks @momospnr !
Nothing published for this version
Add all return type in unit tests #132
* Fix #129. * Update Travis CI setting.
Fix #126 annotation reading when class is not compiled (in unit test)
[ADD] Weaver class to boost the performance. #117 #119
Weaver class to boost the performance. #117 #119Thanks, @izayoi256 @4n70w4 creating the issue and helped us.
仙厓義梵 - 円相図
Thanks @amashigeseiji for reporting the issue! https://github.com/bearsunday/BEAR.Resource/issues/200
Fix #113
Thanks @amashigeseiji for reporting the issue! https://github.com/bearsunday/BEAR.Resource/issues/200
Nothing published for this version
Fix #108 return void type Thanks @wand2016!
Fix #108 return void type
Thanks @wand2016!
Support global namespace class #107
Support global namespace class #107
It is ideal for a legacy application.
Nothing published for this version
Cleaner generated code. To avoid the issue #99, Wrap generated class namespace with the same namespace of the original class.
* Drop php 7.0 support !image 仙厓義梵「犬図」
仙厓義梵「犬図」
* Support PHP 7.3 #95 * Fix coding standard #96
require nikic/php-parser ^4.0.2 (from ^3.0)
Fix variadic parameters issue #90
fix nullable parameter issue for PHP7.1+ #88
[fix] Allow multiple same-type annotation in same method # 87
This release fix the problem that serialization failed in least version ^1.2 #86
This release fix the problem that serialization failed in least version ^1.2 #86
Performance improved with more customized AOP template, (
Performance improved with more customized AOP template, (
v 2.7.1
compile 8.17704201[ms]
initialize 1.97626686[ms]
intercepting 0.63554502[μs]
no_intercepting 0.02644587[μs]
native_call 0.02699208[μs]
v.2.7.0
compile 8.07404518[ms]
initialize 1.98450422[ms]
intercepting 1.32466006[μs]
no_intercepting 0.02658391[μs]
native_call 0.02713704[μs]
[Add] Add MethodInvocation::getNamedArguments() method #84
[add] Default annotation loader #83
Refactor code with phpstan #78 #79 and strict type true #82
Refactor code with phpstan #78 #79 and strict type true #82
Support PHP 7.1 Nullable return type #75
One column per quarter.