dudu / proxy-interceptors
This bundle provides Magento 2 style interceptors for Symfony
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
Type:symfony-bundle
pkg:composer/dudu/proxy-interceptors
Requires
- friendsofphp/proxy-manager-lts: ^1.0
- symfony/dependency-injection: ^6.0|^7.0
- symfony/framework-bundle: ^6.0|^7.0
This package is not auto-updated.
Last update: 2025-10-24 20:31:33 UTC
README
Getting started
This bundle adds Magneto 2-like plugin support for symfony
Adding Example Plugin
- create plugin class and implement before*,after*oraround*methods for target class, ex.afterGetName
- register service with tag app.interceptor, ex:<service id="Vendor\Plugin\Service" public="false" autowire="true" autoconfigure="false"> <tag name="app.interceptor" target="Target\Class\To\Be\Intercepted" sortOrder="10" /> </service>
Before methods
public function beforeGetName(object $subject, ...$arguments): ?array
$subject - class that has been intercepted
$arguments - array of method arguments
The method should return an array of new arguments or a null value (arguments will not be changed).
Around methods
public function aroundGetName(object $subject, \Callable $proceed, ...$arguments): mixed
$subject - class that has been intercepted
$proceed - callable for execute original function
$arguments - array of method arguments
After methods
public function afterGetName(object $subject, mixed $result, ...$arguments): mixed
$subject - that has been intercepted
$result - method result
$arguments - array of method arguments