Soft colored beams converge into a clear glass pyramid; one white beam leaves it.
Declarative behaviors for PHP

Keep your business logic clean.Make your methods powerful.

Attach reusable behaviors to any method. Logging, caching, transactions, authorization and more — without changing your original code.

composer require goaop/framework
The problem

Business logic shouldn't be buried in boilerplate.

Logging, authorization, transactions and metrics shouldn't be repeated across every method.

Before
src/Order/OrderService.php4 concerns, 1 line of logic
public function placeOrder(Cart $cart): Order{    $this->logger->info('Placing order', ['cart' => $cart->id]);    if (!$this->auth->isGranted('ORDER_CREATE')) {        throw new AccessDeniedException();    }    $this->db->beginTransaction();    try {        $order = $this->orders->create($cart);        $this->db->commit();    } catch (\Throwable $e) {        $this->db->rollBack();        throw $e;    }    $this->metrics->increment('orders.placed');    return $order;}
After
src/Order/OrderService.phpyour own attributes
#[Logged]#[Granted('ORDER_CREATE')]#[Transactional]#[Measured('orders.placed')]public function placeOrder(Cart $cart): Order{    return $this->orders->create($cart);}

The attributes are your own classes. Each behavior is written and tested once, and the engine wraps it around every method that carries the attribute. Your domain code never imports the framework.

Performance

Zero cost for code without behaviors.

Under a microsecond for code with them. Every value is rounded up from docs/performance.md, which has the exact figures and how to reproduce them.

  • overhead0for methods and properties that no behavior selects
  • per call< 1 µsfor a call through its middleware, even with three behaviors stacked
  • kernel boot< 0.2 msto boot the kernel on a request
  • to weave≈ 1 sa 2,000-file app at deploy time, with 4 workers

Separate the concerns. Not the code.

Install it, write one behavior, and keep the rest of your code about your domain.

composer require goaop/framework