
No extensions. No black boxes. Just PHP.
The framework works with Composer and generates ordinary PHP files with your behaviors attached. Read them, debug them and run them with the tools you already use.
One Composer package. No extra tooling.
Composer installs the framework and its PHP dependencies. No custom PHP extension to enable, no binary to ship.
composer require goaop/frameworkNo PHP extension
No PECL or PIE step and no C code. The weaver is a Composer package written in PHP, so there is no extension to install, enable or rebuild when PHP or your Docker base image changes.
See the setupNo eval()
The framework never calls eval(). Woven classes are written to real .php files and loaded with include, so OPcache caches them and a review sees every line.
Follow one classStatic PHP files
Your class becomes a trait plus a small proxy class with typed signatures and generic docblocks. IDEs, PHPStan and security scanners read them like your own code.
See the types
The compiler is written in PHP.
The framework works as an ordinary Composer package. It parses your classes, matches them against your rules and generates new PHP source with the behaviors attached. No custom extension to install, enable or rebuild.
In development, classes are woven when they are first loaded. In production, compile them once during deployment or image build using cache:warmup:aop. Requests simply include the generated PHP files.
- No custom extension — only PHP's built-in tokenizer extension is required.
- No rebuilds after PHP upgrades — just install compatible Composer dependencies and warm up the cache.
- Same compiler everywhere — development, CI and production.
- Read-only production — prebuilt generated files can run from a read-only filesystem.
<?php
use Go\Aop\Features;
include __DIR__ . '/../vendor/autoload.php';
ApplicationAspectKernel::getInstance()->init([
'debug' => false,
'appDir' => __DIR__ . '/..',
'cacheDir' => __DIR__ . '/../var/cache/aop',
'includePaths' => [__DIR__ . '/../src'],
'features' => Features::PREBUILT_CACHE,
]);
# install: the weaver is a Composer package
composer require goaop/framework
# deploy: weave the whole cache once
vendor/bin/aspect cache:warmup:aop public/index.php
Generated PHP, loaded like any other file.
The framework generates PHP source instead of executing code from strings. Each woven class produces two files in the cache, loaded through PHP's standard include. OPcache handles them like any other PHP file — and every generated line remains open for inspection and debugging.
Your source
A transaction behavior is attached to placeOrder(). Your file stays exactly as you wrote it.
<?php
declare(strict_types=1);
namespace App\Order;
final class OrderService
{
public function __construct(
private readonly OrderRepository $orders,
) {}
public function placeOrder(Cart $cart): Order
{
return $this->orders->create($cart);
}
}
Woven source
Your class body, as the trait OrderServiceOriginalTrait. Only the declaration line changes, so line numbers match and Xdebug breakpoints still fire. One added line loads the proxy.
<?php
declare(strict_types=1);
namespace App\Order;
trait OrderServiceOriginalTrait
was: final class OrderService
{
public function __construct(
private readonly OrderRepository $orders,
) {}
public function placeOrder(Cart $cart): Order
{
return $this->orders->create($cart);
}
}
include_once AOP_CACHE_DIR . '/src/Order/OrderService.php';
Proxy class
The class PHP loads: your class name, still final, using the trait. Each method with a behavior runs it as middleware, then calls your original method through a private alias.
<?php
declare(strict_types=1);
namespace App\Order;
use Go\Aop\Framework\InterceptorInjector;
use Go\Aop\Framework\Interceptor;
use Go\Aop\Framework\The;
use Go\Aop\Intercept\DynamicMethodInvocation;
use App\Aspect\TransactionAspect;
final class OrderService implements \Go\Aop\Proxy
same name, still final
{
use OrderServiceOriginalTrait {
your class body
OrderServiceOriginalTrait::placeOrder as private placeOrderOriginalAlias;
}
public function placeOrder(\App\Order\Cart $cart): \App\Order\Order
{
/** @var DynamicMethodInvocation<self, \App\Order\Order> $__joinPoint */
typed for PHPStan and IDEs
static $__joinPoint = InterceptorInjector::forMethod(
self::class,
'placeOrder',
[
Interceptor::around(The::aspect(TransactionAspect::class)->inTransaction(...)),
Ctrl-click opens the behavior
],
$this->placeOrderOriginalAlias(...),
your original method
);
return $__joinPoint->__invoke($this, [$cart]);
}
}
Object-oriented code that PHPStan understands
The woven code is classes and traits with typed signatures, with no magic methods in between. Each joinpoint carries a generic docblock, so PHPStan and your IDE know that $__joinPoint->__invoke() returns an Order, even inside the cache directory.
- Your class name, final keyword and typed signatures are kept
- Everything that runs is a file in the cache, with no __call() indirection
- Joinpoints declare @template types, e.g. MethodInvocation<OrderService, Order>
- Cache paths mirror your source, so reviewers and scanners find every file
public function placeOrder(\App\Order\Cart $cart): \App\Order\Order
{
/** @var DynamicMethodInvocation<self, \App\Order\Order> $__joinPoint */
static $__joinPoint = InterceptorInjector::forMethod(
static $__joinPoint
DynamicMethodInvocation<OrderService, Order>__invoke(…): Order
From the @var docblock in the woven file
self::class,
'placeOrder',
[
Interceptor::around(The::aspect(TransactionAspect::class)->inTransaction(...)),
],
$this->placeOrderOriginalAlias(...),
);
return $__joinPoint->__invoke($this, [$cart]);
}
var/cache/aop/
├── _include.cache # class map for Composer
└── src/
├── Aspect/
│ └── TransactionAspect.cache.php # compiled pointcuts of the behavior
└── Order/
├── OrderService.php # proxy class
└── OrderServiceOriginalTrait.php # your class body
The woven method calls your behavior directly, as a first-class callable, so your IDE can jump to it. Details in the README.
Everything else in the box
- Intercept anythingNo method is off limits.
- Property hooksIntercept every property read and write.
- DebuggableNo magic you can't step through.
- PerformanceZero cost without behaviors, under 1 µs with them.
- Pointcut languageSelect exactly the code you mean, and try it live.
- Class extensionsNew interfaces and traits for existing classes.
- Works with your stackSymfony, Laravel, Yii3 and your AI coding agent.