NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist
Framework for aspect-oriented programming in PHP.
Latest stable
4.0.0
Last release 16 days ago
07 Nov 2026
Ships unpredictably
gaps range from 2 weeks to 4.1 years
Most releases are documented
notes for 28 of 33 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
39 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
Go! AOP 4.0 is the biggest release in the framework's recent history. The weaving engine, the code generator, the caches and the container have all be
Go! AOP 4.0 is the biggest release in the framework's recent history. The weaving engine, the code generator, the caches and the container have all been rewritten for PHP 8.4+. Aspects can now reach code that was out of bounds before: private methods, properties through native property hooks, and enums. In production, woven classes load like any other class: Composer serves them from its class map, OPcache caches them, and a request makes zero source-file checks.
The original class body becomes a trait (FooOriginalTrait), and the proxy class uses it instead of extending a renamed copy. Woven classes keep their real inheritance chain, self:: resolves naturally, and the proxy calls original bodies through first-class callables ($this->doSomethingOriginalAlias(...)) without Closure::bind. Proxies are now built by the framework's own AST-based generator instead of laminas-code.
access(...) pointcuts intercept reads and writes of public, protected and private properties, including constructor-promoted and trait properties. Asymmetric visibility (private(set)) and attributes are preserved, and arrays are passed by reference so indirect modification still works.readonly classes with properties can now be woven.Generated code wires advices as first-class callables, which is clear to read and fast to run:
Interceptor::before(The::aspect(MonitorAspect::class)->beforeMethodExecution(...))
Compiled advisor caches use a lazy static form (Interceptor::before(MonitorAspect::class, 'beforeMethodExecution')). Including a cache file creates no aspects and no closures. Weaving never creates aspects: an aspect is constructed the first time one of its advices runs.
_include.cache maps woven classes to their cached files and is handed to ClassLoader::addClassMap(). Untransformed classes are served untouched, and known includes skip php://filter.serialize() blobs.PREBUILT_CACHE trusts the cache completely: no freshness probes at runtime. A cache miss fails fast with a clear message instead of writing into a read-only release.cache:warmup:aop --workers=N: parallel weaving with a progress bar, bounded memory (--cached-files) and --fail-fast. It returns a failure exit code if any file fails, so a broken cache is never shipped.cache:warmup:aop --cache-dir=DIR: builds the next release's cache next to the running one, then you swap it in.cache:warmup:aop --preload: writes an opcache.preload script for the whole AOP cache.cache:warmup:opcache: primes opcache.file_cache at image build time and checks your OPcache settings.See the new performance guide for the production checklist, OPcache tuning, and Docker/Kubernetes recipes.
AspectContainer is a ContainerInterface, and setDelegate() lets aspects pull their dependencies from your application's container.addLazyService() or add().WovenEntityClassLocator makes Doctrine map woven entities.@template generics, so PHPStan and IDEs know the types of getThis() and proceed() inside advices.AspectCircularReferenceException), instead of running on a half-built object.#[\SensitiveParameter] values no longer appear in framework stack frames.WeavingExceptions with hints for classes whose ancestors Composer cannot locate. Opt in to Features::PARTIAL_REFLECTION to weave such classes anyway.Go\Aop\Exception\ExceptionInterface and belongs to a group by phase: configuration, aspect definition, weaving or runtime.PointcutSyntaxException instead of silently matching nothing.Tested on PHP 8.4 and 8.5, including PHP 8.5 first-class callable default values ($cb = strlen(...)). Known limitations are documented in docs/php84-limitations.md and docs/php85-limitations.md.
composer.json); psr/container is new and laminas/laminas-code is no longer used.public.registerAspect() is removed. Use $container->addLazyService(MyAspect::class, static fn() => new MyAspect()).AspectContainer::getValue() is now get() (PSR-11).? wildcard is removed (use *; a leading ? now means nullable), dynamic(...) pointcuts and DeclareError are removed, and modifier and | semantics are stricter.INTERCEPT_FUNCTIONS and INTERCEPT_INITIALIZATIONS turn on automatically from your pointcuts, and PARAMETER_WIDENING is gone.bin/aspect cache:warmup:aop.AdviceBefore/AdviceAfter/AdviceAround are replaced by AdviceTypeEnum. Many framework classes are now final or @internal.The full list, with before/after examples, is in UPGRADE-4.0.md and CHANGELOG.md.
Upgrading from 3.x? Start with the UPGRADE-4.0 guide. Most applications only need its six-step quick checklist.
PHPUnit 13 in strict mode, PHPStan 2 at level 10 over src/ and tests/, PER-CS coding style, and a transformation performance benchmark run in CI on every pull request that touches the weaving pipeline.
Thank you to everyone who reported issues, tested development builds and kept using Go! AOP over the years. Your feedback shaped this release. Enjoy 4.0!
Full diff: https://github.com/goaop/framework/compare/3.1.1...4.0.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
See UPGRADE-4.0.md for the migration guide.
Requirements
ext-tokenizer, goaop/parser-reflection ^4.2.1 || ^5.2.1, goaop/dissect ^4.0, psr/container ^1.1 || ^2.0 and symfony/finder ^7.4 || ^8.0. nikic/php-parser 5 comes through parser-reflection and is no longer required directly. symfony/console ^7.4 || ^8.0 is needed for the bin/aspect tool.Added
Interceptor::before(The::aspect(MonitorAspect::class)->beforeMethodExecution(...)) — an eager first-class callable, since the interceptor list is only built while the intercepted method or hook is already executing (LazyAdvisorAccessor is removed). Compiled advisor cache files use the same facade in its lazy static-data form, e.g. Interceptor::before(MonitorAspect::class, 'beforeMethodExecution'), which returns a native PHP lazy proxy: interceptor construction, aspect resolution from the container and advice callable creation are all deferred until the advice is actually used, so cached advices whose pointcut never matches never instantiate their aspect. Advices registered in the container as plain closures (not aspect methods) are resolved through the new The::advice('advisorId') accessor, which unwraps Advisor and interceptor values down to the raw advice closure.private function foo()) and static (private static function bar()) private methods can now be intercepted by aspects. This was impossible with the old extend-based engine because PHP does not allow overriding private methods in subclasses.access(...) pointcuts intercept reads and writes of public, protected and private instance properties, including constructor-promoted properties and properties declared in traits. The proxy re-declares every intercepted property with get/set hooks that dispatch through FieldAccess joinpoints (by reference for arrays, so indirect modification keeps working); asymmetric visibility (private(set), protected(set)) and property attributes are preserved. Readonly, static and already-hooked properties are never intercepted, see docs/php84-limitations.md.FooOriginalTrait); a proxy enum re-declares the cases and dispatches intercepted methods via per-method static $__joinPoint caching. Built-in enum methods (cases, from, tryFrom) and initialization joinpoints are never woven.Closure default values expressed via first-class callable syntax (e.g., function foo($cb = strlen(...))). The raw AST expression node is preserved through the proxy-generation pipeline so the generated source code reproduces the original FCC default verbatim.docs/php85-limitations.md.Joinpoint, Invocation, MethodInvocation, ConstructorInvocation, FieldAccess, FunctionInvocation, ...) declare @template types for the target class and the return value, so PHPStan and IDEs know the types of getThis(), proceed() and friends inside advices.#[\Deprecated]).AspectContainer::onRegistration(string $interfaceFQCN, Closure $listener): the listener receives the id (class-name) and the container whenever a deferred service whose id implements the interface is registered via addLazyService(); matching never autoloads, so an id whose class is not loaded yet reaches the listener as a candidate. Values are never touched, so laziness is preserved; with no listeners armed (production) registration stays a pure array write. The kernel arms one Aspect::class listener in debug mode to track aspect source files as freshness resources at registration time, resolving them through composer without loading the aspects (previously hardwired into registerAspect()). AspectContainer::addResource() is now part of the interface and final public on Container (was final protected).AspectContainer extends Psr\Container\ContainerInterface: getValue() is renamed to get(), has() is inherited from the PSR interface. ServiceNotFoundException implements NotFoundExceptionInterface, and a container entry of the wrong type in getService() throws the new Go\Aop\Exception\ContainerException (an InvalidConfigurationException implementing ContainerExceptionInterface).AspectContainer::setDelegate(ContainerInterface $delegate) attaches the PSR-11 container of the application: get()/getService()/has() fall back to it for unknown ids. Aspects are registered in configureAop() with addLazyService() as before, and their factories resolve dependencies from the delegate on first use, once the application has built its container; weaving and cache warm-up never need it. The delegate is never enumerated (PSR-11 has no lookup by interface or tag), framework bridges can collect tagged services and register them.Interceptor facade, which exposes the aspect class, the advice method, the order and the expression without resolving the aspect. An aspect is created on the first call of one of its advices, also one without instance properties, whose factory used to run as soon as the weaver collected the aspects (before an application container attached with setDelegate() existed). New AspectContainer::getServiceIdsByInterface() lists service ids without creating the services. AspectLoaderExtension::load() takes the ReflectionClass of the aspect only, AbstractAspectLoaderExtension::parsePointcut() the ReflectionClass of the aspect instead of the instance./plugin marketplace add goaop/framework, plugin goaop) with two Agent Skills in plugins/goaop/skills. aspect-oriented-development teaches an agent the user-facing API: when an aspect fits, the framework bridges, pointcut syntax, advice types and joinpoints, kernel setup, cache deployment, performance, tested recipes (logging, caching, transactions, retry, authorization, metrics, circuit breaker, rate limiting) and troubleshooting. aspect-oriented-refactoring converts existing object-oriented code: it describes how to find code repeated across methods, and the refactorings "Extract an aspect" and "Extract an advice" move them into aspects behind marker attributes without changing behaviour. The plugin ships with the composer package, so vendor/goaop/framework serves the copy that matches the installed version.cache:warmup:aop --workers=N weaves the files in N worker processes and shows a progress bar (-v lists every file). --cached-files=N (default 100) bounds the parsed files kept in memory, so a large project no longer exhausts the memory limit.parsedFilesLimit kernel option — bounds the parsed files goaop/parser-reflection keeps in memory while weaving (default 100, ~0.2 MB each; the engine kept every file before). It is also the default of cache:warmup:aop --cached-files.#[AsCommand], bin/aspect loads them lazily, and every command returns Command::SUCCESS/Command::FAILURE (debug:weaving used to return the raw error count). cache:warmup:aop stops cleanly on SIGINT/SIGTERM.loader argument of the console commands is optional: without it the commands use the kernel of the process when it is initialized (AspectKernel::isInitialized()), so a framework integration registers the framework commands as they are in its own console.new CacheWarmer($kernel, cacheDir: $dir) and cache:warmup:aop --cache-dir=DIR (also with --workers) build the cache in a directory other than the one of the kernel, from scratch, while the kernel keeps serving the process from its own directory (CachePathManager::withCacheDir()): a deployment prepares the cache of the next release next to the running one, the way Symfony's cache:clear warms a new cache directory up before swapping it in. Woven sources served while such a build runs include their proxies from the directory being built.cache:warmup:aop --preload[=FILE] writes _preload.php (or FILE) after a complete warm-up: it requires the Composer autoloader, adds the woven class map and links every woven and untransformed class of the cache at PHP start, with paths relative to __DIR__ so a moved cache stays valid; classes with static initialization advices and classes that can not be linked are left to the request. Replaces the userland script of docs/performance.md (#812).cache:warmup:opcache — primes opcache.file_cache at image build time (Composer class map and files, the AOP cache, the loader and --entry files), checks the OPcache settings and prints the command line to run when they are missing, and lists the files that fail to compile without stopping (#813).Go\Bridge\Doctrine\WovenEntityClassLocator lets Doctrine mapping drivers (ORM 3.6+) discover entities through the autoloader, so the woven class is mapped instead of the original source, and entities loaded before discovery are no longer missed. MetadataLoadInterceptor no longer rewrites metadata (the old mapped-superclass workaround only matched the extend-based engine); it now reports woven entities with intercepted mapped properties when Doctrine native lazy objects are disabled. It is registered as a plain listener: $eventManager->addEventListener(Events::loadClassMetadata, new MetadataLoadInterceptor()) (it is no longer an EventSubscriber).Go\Aop\Exception\AspectCircularReferenceException (a RuntimeException implementing PSR ContainerExceptionInterface) with the aspect, the joinpoint and the calls from the creation to the advice, e.g. ClockAspect -> Scheduler->__construct() -> Clock->now() -> ClockAspect->beforeNow(). Such an advice used to run on the half-initialized lazy aspect: PHP reported an uninitialized property at best, an advice reading no property ran without any error (#783).Features::PARTIAL_REFLECTION flag reflects classes with the partial policy of goaop/parser-reflection 4.2/5.2 (MissingAncestorPolicy::Partial, applied by AspectKernel::init()): a parent class, interface or trait declared by code generated at runtime, by a class_alias() or in a file outside the Composer autoloader no longer fails the file (and cache:warmup:aop). The class is matched and woven with its own methods and properties and the ones of its available ancestors; members inherited from a missing ancestor are not intercepted. The proxy still declares the missing parent class and interfaces, which must be loaded by the time the class is. Without the flag such a class fails to weave, as before.class_alias(), a file outside the Composer autoloader), the WeavingException tells how to make the class loadable or to exclude the classes depending on it with excludePaths (#782).Changed
FooOriginalTrait) and the proxy class uses it via use with private method aliases instead of extending the renamed class. This removes the renamed <Class>OriginalTrait parent from the inheritance chain.__aop__ prefix. The trait holding the original class body is now suffixed with OriginalTrait (FooOriginalTrait instead of Foo__AopProxied) and the private trait aliases that back the original method bodies carry their own OriginalAlias suffix (doSomethingOriginalAlias instead of __aop__doSomething). Accordingly AbstractMethodInvocation::TRAIT_ALIAS_PREFIX is replaced by AbstractMethodInvocation::TRAIT_ALIAS_SUFFIX ('OriginalAlias'), AspectContainer::ORIGINAL_TRAIT_SUFFIX is 'OriginalTrait', and the hooks declared by InitializationAware and StaticInitializationAware are renamed to __initialization() and __staticInitialization(). Cached proxies generated by an earlier 4.0 development version must be regenerated.#[Before], #[After], #[Around] or #[AfterThrowing] can no longer be protected or private — the aspect loader now throws an AspectException for non-public advice methods. Methods holding only a #[Pointcut] attribute may keep any visibility.AdviceBefore, AdviceAfter and AdviceAround marker interfaces. The Advice interface now requires getType(): AdviceTypeEnum, and the new AdviceTypeEnum backed enum (Before, After, AfterThrowing, Around, Introduction) carries both the advice kind and its invocation priority used for joinpoint sorting.DynamicTraitAliasMethodInvocation, StaticTraitAliasMethodInvocation, ReflectionFunctionInvocation) now require a Closure $closureToCall parameter (non-nullable). Generated proxy code always passes a first-class callable: $this->methodOriginalAlias(...) for own instance methods, self::methodOriginalAlias(...) for own static methods, parent::method(...) for inherited methods, and \functionName(...) for functions.self:: in proxied classes now resolves to the proxy class naturally (via PHP trait semantics), removing the need for SelfValueTransformer.$this->methodOriginalAlias(...), parent::method(...), \func(...)) to reference original method and function bodies, eliminating the need for Closure::bind at construction time.Go\Proxy\Generator package built on nikic/php-parser instead of laminas/laminas-code, which is no longer a dependency. Code that extended the framework generators or relied on laminas generator classes must be updated.? single-character wildcard is removed from pointcut name and type patterns: it collided with the nullable type syntax. In return-type patterns a leading ? is now a nullable marker (?Foo equals Foo|null). Replace ? wildcards with *.ModifierPointcut is final and immutable: the masks are constructor arguments and andMatch()/orMatch()/notMatch() return a new instance instead of modifying the pointcut._proxies subdirectory is gone: a proxy is stored at the relative path of its source file below the cache directory, and the woven source (the ...OriginalTrait body) next to it with the OriginalTrait suffix. Clear the cache directory when upgrading.Go\Aop\Exception\ExceptionInterface and is grouped by phase: configuration, aspect definition, weaving, runtime (see UPGRADE-4.0).final; framework-internal services are marked @internal.#[Aspect] attribute, Pointcut::KIND_TRAIT (KIND_ALL is 119), InterceptedConstructorGenerator, FunctionParameterList and a few unused methods; see UPGRADE-4.0.| alternatives bind tighter, so final public|protected no longer matches every non-final public method. Foo+ also matches Foo itself and classes using the trait Foo. @execution/@within/@access match subclasses of the attribute. Return-type patterns accept the ?Foo nullable marker, and regular-expression failures raise a PointcutSyntaxException instead of silently not matching.WeavingException instead of silently returning a copy. The new matchReturningByReference() pointcut excludes them (&& !matchReturningByReference()).#[\Override] — a woven trait strips #[\Override] from its intercepted methods like a woven class does, instead of failing to load. A class importing such a method can not intercept it: weaving fails with a WeavingException instead of a fatal error at load time; exclude it with && !matchInherited() or advise the trait itself (#761).TransformerResultEnum::RESULT_* becomes TransformerResult::{Aborted, Abstain, Transformed}; enum cases use PascalCase everywhere (FieldAccessType::Read/Write, and the Proxy\Generator enums Visibility, PropertyModifier, ClassModifier); AspectContainer::AOP_PROXIED_SUFFIX becomes ORIGINAL_TRAIT_SUFFIX plus ORIGINAL_TRAIT_FILE_SUFFIX.Performance
clearstatcache() and stat() of _include.cache before including it, also with Features::PREBUILT_CACHE: the include map carries a stamp of the metadata it was written with (the hash of _transformation.cache), so the state a request loaded is known without a file-system call. Only a flush reads the stamp on disk to detect another writer (#816).AspectContainer::addLazyService() stores a factory instead of building a PHP 8.4 lazy proxy, so registering the built-in services no longer reflects/autoloads them on every request; a service is constructed on first retrieval. Code relying on lazy-proxy instances being available from boot must use getService() instead.registerAspect() removed — the container is now a fully AOP-unaware DI implementation. Register aspects in configureAop() through the generic API: $container->add(Foo::class, new Foo()) for an eager instance, or $container->addLazyService(Foo::class, static fn() => new Foo(...)) for deferred construction on first use (first advice hit or first real interaction with the lazy object). AspectContainer::registerAspect(), the internal per-aspect validators and the double per-aspect validation pass are gone; a factory returning an incompatible object now fails on first use via the container's instanceof guard instead of at retrieval. Aspect enumeration on the weaving path is unchanged (getServicesByInterface(Aspect::class) finds deferred aspects by id)._include.cache holds a woven-class => cached-file map plus a skip set of known untransformed classes. At production boot the class map is handed to composer via ClassLoader::addClassMap(), so woven classes resolve natively to their cached files (composer consults the class map before PSR-4) with no per-class realpath(); untransformed classes are served untouched. _transformation.cache keeps the full build metadata and is loaded lazily, only on the cache-miss/weaving paths. Both files are constant arrays: records are keyed by the source path relative to the application root and cached files are written as __DIR__ . '/…', so opcache keeps them as they are and a moved application or cache directory stays valid. Cache format bump: a pre-4.0 cache directory carries no class names and is treated as stale — everything re-weaves once (or run cache:warmup:aop at deploy). New accessors: CachePathManager::queryClassMap(), querySkippedClasses(), registerClassForResource().Features::INTERCEPT_INCLUDES, _include.cache also maps every source known to the cache (path relative to the application root) to its cached file, or to null when it was not transformed. In production FilterInjectorTransformer::rewrite() serves an include of a known file like the class map serves a known class: the original file when it is untransformed, the recorded cached file when it is woven, with no php://filter pass (which opcache never caches), no freshness check and no load of _transformation.cache; unknown files still go through the filter. An include of an untransformed file on a warm request drops from ~250 µs to ~11 µs (#746). Cache format bump (CachePathManager::FORMAT_VERSION 4): an older cache re-weaves once, a PREBUILT_CACHE one must be rebuilt with cache:warmup:aop. New accessor: CachePathManager::findIncludeFile().PREBUILT_CACHE now really trusts the cache — with Features::PREBUILT_CACHE enabled, an existing cache record is used without any freshness checks: cache directory existence/writability probes, source filemtime comparisons, tracked-resource checks and advisor cache freshness are all skipped (previously the flag only skipped one writability check). Build the cache at deploy time (bin/aspect cache:warmup:aop); staleness is the deployer's responsibility. An advisor cache file of an incompatible (older) format falls back to the direct loader without writing (read-only file systems stay safe); a corrupt, non-includable file throws.SourceTransformer interface and assembled in registration order; the stream filter and the transformers are only registered/constructed on the first cache miss (SourceTransformingLoader::ensureRegistered()), never on a warm-cache request. The protected AspectKernel::registerTransformers() hook (returning transformer instances, used e.g. by AspectMock to swap in its own weaver) is replaced by AspectKernel::registerTransformerServices(AspectContainer $container), which registers deferred container definitions: override it to replace, omit, reorder or extend the built-in transformers, or simply addLazyService() an extra SourceTransformer service from configureAop() to append one. The rewrites of single syntax nodes (new, include/require, __DIR__/__FILE__) are NodeRewriter rules dispatched by one SyntaxTreeRewriter walk per file before weaving, instead of transformers walking the tree on their own; register a NodeRewriter service to add one. A PrefilteredNodeRewriter declares source markers, so files without them skip the rule, and the walk itself when no rule is left: with the default rules most files are not walked at all.CachingTransformer removed — the cache decision now lives directly in SourceTransformingLoader::filter(): a usable cache record makes the filter emit the cached file content as-is, without parsing the source, constructing a single transformer or building StreamMetaData; only a real miss parses and runs the transformer chain, then persists the result. This also removes the old cached-branch double work of re-parsing the cached file to rebuild the token stream, so the warm-cache fast path now applies in debug mode too (freshness checks preserved). SourceTransformingLoader::transformCode() returns the overall TransformerResult and addTransformer() is gone — register transformers as container services instead (AspectKernel::registerTransformerServices()).serialize()d blob under {cacheDir}/_aspect/sha1(FQCN). Each aspect's pointcut/advisor graph is now compiled into an includable plain-PHP file returning ['version' => 1, 'advisors' => [...]] built from nested static constructor expressions (advice leaves are pure-static-data Interceptor::before(SomeAspect::class, 'method') lazy facade calls, so including a cache file constructs no aspects and no advice closures), shadowing the aspect source below the cache directory: {appDir}/src/Aspect/LoggingAspect.php is cached as {cacheDir}/src/Aspect/LoggingAspect.cache.php. Loading a warm advisor cache is a single opcache-friendly include with no unserialization. Cache format bump: clear your AOP cache directory when upgrading (or re-run cache:warmup:aop); stale-format files are rebuilt automatically outside PREBUILT_CACHE mode. Aspects whose source is not below appDir are loaded directly and never cached.php://filter on every request; woven files, stale records and misses keep the filter (XDebug breakpoints and magic constants of woven files rely on it, a changed source is woven again). Both the filter and the autoloader use one freshness rule, CachePathManager::queryFreshCacheState(). AspectKernel::init() tracks the aspect files without loading the aspects: their files are resolved through the wrapped composer loaders (AopComposerLoader::findOriginalFile()). AspectContainer::onRegistration() never autoloads any more: an id whose class is not loaded yet reaches the listener as a candidate. Warm debug request of the fixture project: init() ~1.3 ms → ~0.25 ms, an untransformed file ~38 µs → ~10 µs, the whole request 27–40% faster.static $__joinPoint with its @var docblock, the InterceptorInjector::for*() call and the __invoke()), instead of printing each body to a string and parsing it back; the proxy is printed once. Intercepted methods are looked up in a name index built once per woven class, declared types are converted from the syntax tree without a round trip through reflection types, and attribute arguments are cloned by one shared traverser. Generated proxies are byte-identical; proxy generation takes about a third of its former time (weaving case of the transformation benchmark: −43%). ClassProxyGenerator::getJoinpointInvocationBody() is replaced by getJoinpointInvocationStatements() and createOriginalMethodCallable().ClassFieldAccess, the method and function joinpoints no longer build reflection in their constructors. getFunction() creates it when an advice first asks, and the reflection that DynamicTraitAliasMethodInvocation needs to call the original method is created on the first call that reaches it. Joinpoints whose advices never ask for reflection (e.g. an around advice serving a cached result) build none. A callable without a scope class or an unknown function name is now reported on first use instead of at construction.Removed
Features::INTERCEPT_FUNCTIONS and Features::INTERCEPT_INITIALIZATIONS: the framework enables function and initialization interception from the registered pointcuts themselves. execution(Namespace\function(*)) pointcuts weave function proxies without a flag, and the rewriting of new turns itself on while an initialization(...) pointcut is registered, lazily registered aspects included (the new internal AdvisorIndex loads them and tracks the pointcut kinds of every advisor). Before, an initialization(...) pointcut without the flag wove __initialization() but never ran its advice.Features::PARAMETER_WIDENING and the parameter-widening code path in the proxy generators. The feature was a PHP 7.0/7.1 compatibility aid (parameter type widening, wiki.php.net/rfc/parameter-no-type-variance) that has been a no-op concern since the PHP 7.2 baseline: generated proxies always keep the original parameter types. Remove the flag from AspectKernel::configureAop() options if you passed it.DeclareError attribute, DeclareErrorInterceptor, and PointcutBuilder::declareError(). Use Before or Around interceptors to emit user warnings or throw exceptions instead.dynamic(public Foo->method*(*))), including MagicMethodDynamicPointcut, DynamicInvocationMatcherInterceptor, the Pointcut::KIND_DYNAMIC constant and the $instanceOrScope/$arguments parameters of Pointcut::matches(). Use a traditional execution pointcut for the magic methods instead, e.g. execution(public Foo->__call(*)) or execution(public Foo::__callStatic(*)), and check the invoked method name from $invocation->getArguments()[0] inside the advice.SelfValueTransformer and SelfValueVisitor — no longer needed with the trait-based engine.serialize()-able: AbstractInterceptor::__serialize()/__unserialize() and the protected serializeAdvice()/unserializeAdvice() hooks are removed; advisor caches restore advices via first-class callables on aspect instances instead.Fixed
Features::PREBUILT_CACHE never weaves nor writes to the cache directory, also on a cache miss: a class or an included file below the include paths that the prebuilt cache has no record of, or a record whose cached file is gone, fails fast with a WeavingException naming it and telling to rebuild the cache with cache:warmup:aop (WeavingException::sourceMissingFromPrebuiltCache(), cachedFileMissingFromPrebuiltCache()), before any parser, transformer or aspect is loaded. Such a source used to be woven by the request and written into the prebuilt directory, which failed on a read-only file system only after the weaving, and a missing cached file raised a warning first. Files the weaver never takes (outside the include paths, excluded, not .php) are served as they are; cache:warmup:aop weaves and writes as before, and a class its loader file loads before the build starts (an application bootstrap building its container) is loaded unwoven there, without writing, and woven by the build (CachePathManager::markBuildProcess(), also in the workers) (#808).cache:warmup:aop over an existing cache directory of a kernel with Features::PREBUILT_CACHE weaves again the files whose source changed (size or modification time) instead of keeping every woven file: the build checks the freshness of the records like without the flag, also in place and in the worker processes, and rebuilds metadata of another format instead of rejecting it (CachePathManager::$isBuildingCache, set by withCacheDir()). Requests keep trusting the prebuilt cache (#809).cache:warmup:aop --cache-dir with a production kernel ('debug' => false) whose own cache is warm no longer fails with "Class X was not found in .../XOriginalTrait.php" for classes the weaver reflects by name (ancestors, classes of property advices): goaop/parser-reflection used to locate them through the Composer loader, which serves the woven class map of the own cache in production. AopComposerLoader::init() installs OriginalSourceLocator into ReflectionEngine: it asks every Composer loader for the original source, a wrapped one by its rules from before the class map was injected (AopComposerLoader::findSourceFile()), so the weaver reads original sources in every weaving path (#807).ReflectionEnumUnitCase::getAttributes() and getDocComment() of a woven enum return them, #[\Override] on a case (PHP 8.6) included. The doc comment of a case no longer stays behind in the woven trait, where PHP gave it to the next method, and a case with an attribute on its own line no longer shifts the line numbers of the methods after it (#794).#[\SensitiveParameter] no longer show up in the framework frames of a stack trace: the joinpoints, the generated __initialization() and the rewriting of new take the arguments as an array with the attribute, and a constructor joinpoint passes them to ReflectionMethod::invokeArgs() instead of spreading them into invoke(), which printed every constructor argument, the secret included, in the text of the trace. The frames of invokeArgs() and forward_static_call_array(), internal functions, still hold the array in Throwable::getTrace(), see the advice limitations (#795).$this-><method>OriginalAlias(...) of that object, keeps only the class and the name of the callable. AbstractMethodInvocation no longer takes or stores the callable; DynamicTraitAliasMethodInvocation and StaticTraitAliasMethodInvocation keep their constructors (#796).readonly class with properties (declared or promoted, and on PHP 8.6 with defaults) can be woven: the woven trait declares each of its properties readonly, since a trait can not be readonly itself. Loading such a class used to fail with "Readonly class X cannot use trait with a non-readonly property" (#792).$aspect->cache(?, 300) — is referenced as a container advice (The::advice('<advisor id>')) in generated proxies and is rejected by the advisor cache compiler. Its {closure:...} name used to be rendered as the advice method, The::aspect(CacheAspect::class)->{closure:...}(...), which made the proxy fail to parse (#790).Features::PREBUILT_CACHE, which never creates it at runtime: the records of the warm-up used to be dropped silently when no file was woven, and every request parsed the sources again.CachePathManager recognizes a rewritten _include.cache (a warm-up into the directory, a concurrent request, a deployment swapping a warmed-up directory in, the way Symfony's cache:clear does), keeps those records and adds only the records of sources they do not cover. The shutdown flush of the process that ran the warm-up used to overwrite the warmed-up map with its own view.use imports, and imports that collide with names of the original file (its imports, the class itself, names used in its body) or with each other (aspects sharing a short name) get a distinct alias automatically, e.g. use Go\Aop\Framework\Interceptor as AopInterceptor;. Such collisions used to make the proxy fail to compile (#668).CacheFileWriter (temporary file + rename, opcache invalidation), so a concurrent request can no longer include a half-written proxy (#670). Cache directories get search permissions matching the read bits of cacheFileMode, and an invalid cacheFileMode (outside 0600..0777 or without owner read/write) is rejected by the kernel.public int $a, $b; keep their non-intercepted items; line numbers are preserved (#669)./app/src/app/Foo.php), or a sibling sharing its name prefix (/var/www-old for /var/www), no longer maps to a wrong cache file, and only the trailing .php extension receives the OriginalTrait suffix (#682).cache:warmup:aop returns Command::FAILURE when a file fails to weave, writes every error with its message to stderr, and stops at the first error with --fail-fast, so a deploy no longer ships an incomplete prebuilt cache. CacheWarmer::warmUp() returns the number of failed files; its error handler honours error_reporting() and @, and is restored when an exception escapes (#674).Features::PREBUILT_CACHE never writes an advisor cache file (a missing file falls back to direct loading), and a cache payload with an invalid entry is rebuilt as a whole instead of silently dropping the entry (#680).TransformerResult::Aborted reverts the changes of the whole transformer chain as documented: the original source is served and recorded as untransformed (it used to emit the partially transformed source). Functional tests cover magic constants of unwoven files in debug and production mode (#679).new sees getThis() === null instead of the previous object, a nested new of the same class returns the right object, the constructor invocation no longer keeps the created object alive, and an advice touching the same property of another object no longer clobbers the outer access (#672).PointcutBuilder get stable advisor ids derived from the expression, the advice kind and the closure's source location instead of a process-wide counter, so changing the order of registrations in configureAop() no longer makes cached proxies call the wrong advice or fail with an unknown id (#640)._transformation.cache, _include.cache) carry a format version: a cache of another version is rebuilt, and with Features::PREBUILT_CACHE it fails with a hint to run cache:warmup:aop. Records keep the size and mtime of the woven source, so a source whose mtime moved backwards (rsync -t, checkout of an older revision) is woven again instead of serving the stale proxy (#685).cache:warmup:aop and debug:advisor no longer fail with "Cannot rewind a generator that was already run" when more than one include path is configured (#751).Holder.php/App/First.php): the proxies used to share one cache file, so all classes but the last one were not found (#760).docs/pointcuts.md (#774): * matches any characters of one name part, including none (Sensor* now matches Sensor, get* a method named get, the return type pattern Exc* the type Exc), and | alternatives apply to the name part they are written in (Ns\A|B is Ns\A or Ns\B, no longer Ns\A or the global class B). NamePointcut translates a pattern part by part.Internal
src/ and tests/, php-cs-fixer with the PER-CS rule set, and composer test/analyze/cs/check scripts.Patch release, which includes https://github.com/goaop/framework/commit/d268f6fcc22eacf47a6c97917ca41cc3db5941d0 to allow backward-compatibility with
Patch release, which includes https://github.com/goaop/framework/commit/d268f6fcc22eacf47a6c97917ca41cc3db5941d0 to allow backward-compatibility with 3.x branch
Patch release, which includes d268f6f to allow backward-compatibility with 3.x branch
Fix deprecated GitHub Actions versions in CI workflows by @Copilot in https://github.com/goaop/framework/pull/509
Full Changelog: https://github.com/goaop/framework/compare/3.0.0...3.1.0
PhpToken tokens and goaop/dissect ^3.0 for the pointcut parserGo\Lang\Attribute namespace (#[Before], #[After], #[Around], #[AfterThrowing], #[Pointcut], #[DeclareParents]); the doctrine/annotations integration, the AnnotationAccess interface and the Lang\Annotation namespace are removed, and @execution/@within/@access pointcuts match attributesClassMemberReference as a readonly DTOAspectContainer::addLazyService() accepts only class-string identifiers, and lazy services are tagged automatically by the return type of their factory closureFieldAccess access-type constants are replaced by the FieldAccessType enumTransformerResult enum instead of integer constantsSerializable implementationsself references, never return type supportAbstractMethodInvocation::$instance access for recursive callsBetter late than never! This is next major release of Go! AOP that contains some improvements and uses new code features for better performance and st
Better late than never! This is next major release of Go! AOP that contains some improvements and uses new code features for better performance and stability.
Notable changes are:
laminas/laminas-code package to generate code for proxiesNotice: This version still doesn't support PHP8, see #466, mostly because of absence of PHP8-compatible parser reflection libraries. If you want to contribute this to one of existing projects, this will be very helpful.
zendframework/zend-code package to generate code for proxiesNothing published for this version
This is next major release of Go! AOP that contains some improvements and uses new code features for better performance and stability.
This is next major release of Go! AOP that contains some improvements and uses new code features for better performance and stability.
Notable changes are:
zendframework/zend-code package to generate code for proxiesNothing published for this version
Small patch version to allow installation of Symfony5 components #447
Small patch version to allow installation of Symfony5 components #447
This is a patch release with #425 bug fix.
This is a patch release with #425 bug fix.
Patch release that contains several small fixes
Nothing published for this version
This minor release introduces some fixes:
This minor release introduces some fixes:
goaop/parser-reflection dependency to 2.0+ #403Please, be aware that #403 bumps the PHP minimum version for 2.x branch to be >=7.0.0. As minimum supported PHP version now is 7.2, I decided to drop 5.6 for 2.x branch too.
In emergency cases 2.3.1 patch can be released.
This version introduces latest minor release in 2.x branch. Only security fixes and bug patches will be applied to the 2.x since current release.
This version introduces latest minor release in 2.x branch. Only security fixes and bug patches will be applied to the 2.x since current release.
Fixes:
Improvements:
Features:
BC breaks on code level:
This small patch introduces following fixes, thanks to @TheCelavi:
This small patch introduces following fixes, thanks to @TheCelavi:
[x] Fix fnmatch issue on Windows machine #326
Small patch version with fixes
fnmatch issue on Windows machine #326Version 2.1.0 enables support for PHP7.1. As well it provides some useful features for you applications:
Version 2.1.0 enables support for PHP7.1. As well it provides some useful features for you applications:
void return types for PHP7.1, see #307goaop/parser-reflection library to use the latest version with PHP7.1 support.Invocation->setArguments() method #297/*Bundle/*/Tests, see #300AfterThrowing type of adivce, see #302Here it is! Shiny 2.0.0 version!
Here it is! Shiny 2.0.0 version!
This version contains a lot of fixes and improvements:
Andrewswille/Token-Reflection to the goaop/parser-reflection library for PHP5.6 and PHP7.0 supportChanges from the 1.x branch:
!matchInherited() to exclude all inherited methods from matchingPay attention, that some internal parts are changed, so be careful when updated. Also property interceptors logic is changed now and to modify values in advices, you should use returning by reference methods like following:
/**
* Advice that controls an access to the properties
*
* @param FieldAccess $fieldAccess Joinpoint
*
* @Around("access(public|protected Demo\Example\PropertyDemo->*)")
* @return mixed
*/
public function aroundFieldAccess(FieldAccess $fieldAccess)
{
$isRead = $fieldAccess->getAccessType() == FieldAccess::READ;
// proceed all internal advices
$fieldAccess->proceed();
if ($isRead) {
// if you want to change original property value, then return it by reference
$value = /* & */$fieldAccess->getValue();
} else {
// if you want to change value to set, then return it by reference
$value = /* & */$fieldAccess->getValueToSet();
}
echo $fieldAccess, ", value: ", json_encode($value), PHP_EOL;
}
Andrewswille/Token-Reflection to the goaop/parser-reflection library for PHP5.6 and PHP7.0 supportNothing published for this version
Nothing published for this version
Version 1.2.0 is a minor release with one new feature and several fixes:
Version 1.2.0 is a minor release with one new feature and several fixes:
1.x branch only to the PHP5.5, because andrewsville/php-token-reflection can work only with PHP=<5.5 and is not maintained anymore, see #305includePath and excludePath options, see #300, #311Please, note, that the branch 1.x will not receive any new features and you should plan your time to upgrade to the 2.x versions.
Nothing published for this version
This version contains several important fixes and improvements:
This version contains several important fixes and improvements:
!matchInherited() to exclude all inherited methods from matchingPay attention, that some internal parts are changed, so be careful, when updated. Also property interceptors logic is changed now and to modify values in advices, you should use returning by reference methods like following:
/**
* Advice that controls an access to the properties
*
* @param FieldAccess $fieldAccess Joinpoint
*
* @Around("access(public|protected Demo\Example\PropertyDemo->*)")
* @return mixed
*/
public function aroundFieldAccess(FieldAccess $fieldAccess)
{
$isRead = $fieldAccess->getAccessType() == FieldAccess::READ;
// proceed all internal advices
$fieldAccess->proceed();
if ($isRead) {
// if you want to change original property value, then return it by reference
$value = /* & */$fieldAccess->getValue();
} else {
// if you want to change value to set, then return it by reference
$value = /* & */$fieldAccess->getValueToSet();
}
echo $fieldAccess, ", value: ", json_encode($value), PHP_EOL;
}
Patch release fox fixing the issue #259, which dramatically reduce the performance of the framework.
Patch release fox fixing the issue #259, which dramatically reduce the performance of the framework.
Nothing published for this version
Dropped support for PHP<5.5, clean all old code
1.0.0 (Feb 13, 2016)
PointcutBuilder classincludePath option nowFilterInjector is now disabled by default, this job for composer integration nowNothing published for this version
Nothing published for this version
Minor patch to fix a bug with overwriting of original files
Minor patch to fix a bug with overwriting of original files
Version 0.6.0 is ready! This is probably the last 0.x release and now we are going to 1.0.0.
Version 0.6.0 is ready! This is probably the last 0.x release and now we are going to 1.0.0.
However, this version also includes some improvements and changes:
interceptFunctions=>true use 'features' => $defaultFeatures | Features::INTERCEPT_FUNCTIONS nowstatic::class for PHP>=5.5Deprecate the usage of submodules for framework
Version 0.5.0 of framework is ready!
Nothing published for this version
Add minor changes for supporting CLI-mode
Switched to doctrine/annotations package instead of doctrine/common
Demo namespace from the composer and use it only for testing.Better parsing of complex "include" expressions for Yii (by @zvirusz)
This release contains a lot of new features. Here are the short changelog for them:
This release contains a lot of new features. Here are the short changelog for them:
fopen(), file_get_contents(), etcDeclareParent introductionSupport for dynamic pointcuts: pointcut that match a specific point in the code, if it is under the control flow (look at AspectJ cflow and cflowbelow
Huge pointcuts refactoring, cleaning
Fix bug with composer autoloader prepending
* Initial release of library
One column per quarter.