GenerateProxies
class GenerateProxies
Generate AOP proxy classes for registered aspects.
Runs after all service providers have been registered (so all aspects() calls have executed) and before boot() (so no targeted classes have been instantiated yet). Closes aspect and class map registration even when no proxies need to be generated.
Properties
| static protected ClassLoader|null | $proxyLoader | ||
| static protected array<string, string> | $proxySources | The canonical source file of each generated proxy, keyed by canonical proxy file path. |
Methods
Generate and register proxies in the given directory before their targets load.
Get the canonical source file of each generated proxy, keyed by canonical proxy file path.
Reject already-loaded targets whose code cannot apply the registered aspects.
Build a class map that includes both Composer's static class map and any PSR-4 classes referenced by exact aspect rules.
Flush all static state.
Details
at line 46
void
bootstrap(Application $app)
Bootstrap the AOP proxy generation.
at line 61
void
generate(string $proxyDir)
Generate and register proxies in the given directory before their targets load.
Loaded classes cannot be replaced in the running process.
at line 113
static array
proxySources()
Get the canonical source file of each generated proxy, keyed by canonical proxy file path.
Stack frames report the proxy file, so code that classifies frames by path (such as application versus vendor code) should classify the source instead.
at line 121
protected void
ensureLoadedProxyCoversRules(string $class)
Reject already-loaded targets whose code cannot apply the registered aspects.
at line 181
protected array
buildClassMap()
Build a class map that includes both Composer's static class map and any PSR-4 classes referenced by exact aspect rules.
Composer's getClassMap() only contains explicitly mapped classes, not PSR-4 classes resolved at runtime. For exact class rules (no wildcards), we resolve the file path via findFile() so that PSR-4 classes are eligible for proxying.
Wildcard rules only match against the existing class map.
at line 215
static void
flushState()
Flush all static state.