Tappable helps you create modular PHP apps that accept plugins or "middleware".
A Tappable
app has plugins.
Plugins communicate via actions.
Every action passes through each plugin, sequentially.
Plugins can dispatch new actions, handle actions, keep state, or throw errors.
Each plugin wraps the next plugin. Plugins can wrap next() calls to perform "before" and "after" business logic, try/catch logic, modify actions, cancel actions, etc.
This design enables plugin authors to write modular functionality with versatile, statically-typed interoperability and powerful control flow.
The simple skeleton for a Tappable
app looks like this.
<?php
class MyApp extends TappableBase {}
class MyPlugin extends TapBase {}
class MyAction extends ActionBase {}
$app = new MyApp();
$app->tap(new MyPlugin());
$app->dispatch(new MyAction());
?>