Skip to content

Releases: ray-di/Ray.Aop

2.17.0

15 Nov 15:33
10e8579
Compare
Choose a tag to compare

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

03 Sep 02:54
e7df832
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 2.16.1...2.16.2

2.16.1

27 Aug 08:09
1b2d410
Compare
Choose a tag to compare

What's Changed

2.16.0

07 Jul 05:48
Compare
Choose a tag to compare

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

  1. The Pointcut, Bind, and Weaver classes are no longer used directly. Instead, use the new Aspect class.
  2. The newInstance method is now part of the Aspect class, not Weaver.

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
Tanabata BEAR.Sunday

Full Changelog: 2.15.2...2.16.0

2.15.2

20 May 07:51
41e5af6
Compare
Choose a tag to compare

What's Changed

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

13 May 02:26
284cec0
Compare
Choose a tag to compare

What's Changed

Bug Fix 🐞

Full Changelog: 2.15.0...2.15.1

2.15.0

21 Apr 08:32
da2abe9
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.14.0...2.15.0

image

福島・塩野崎の大桜

2.14.0

11 Sep 17:19
0961e4a
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.13.1...2.14.0

2.13.1

13 Jan 02:48
601eb11
Compare
Choose a tag to compare

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

12 Dec 10:34
2c3f563
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.12.4...2.13.0