Why Taphra works well when coding agents write the code
Coding agents can write a working feature in minutes. Someone still has to read it, understand it and answer for it. Taphra is designed to make that reading fast and reliable.
Why a new framework in the age of coding agents?
If an agent can write the code, why should the framework matter? Because agents work the way careful people do. They read before they change anything, they copy the patterns around them, and they guess when something is hidden. Like people, they should make fewer mistakes and finish sooner when code is readable, explicit and short. We are measuring it: see the agent test pilot.
Most frameworks were designed for people typing code by hand. Shortcuts and hidden wiring saved keystrokes, and that was a fair trade. When an agent does the typing, keystrokes cost almost nothing. Reading and checking are what cost now, for the agent and for the person who answers for its work. Taphra is built for that side of the trade.
Agents read before they write
An agent knows what it learned in training and what is in front of it. Every task starts with reading: the files it will change, the code they call, the conventions they follow. Short files, plain names and one job per class let it understand a feature from a few files instead of many.
Explicit code leaves less to guess
Behaviour wired somewhere else, such as a service looked up by name or a handler found by searching, is invisible where it is used. An agent fills that gap with the most common pattern it has seen, which may come from another framework or another version. In Taphra the wiring is written down: routes live in routes.yml and php taphra route:list prints them, command handlers are registered by name, and by default a command with no registered handler throws instead of being searched for.
Less code is cheaper to read, for people and for agents
Agents work inside a context window and are paid for by the token. Boilerplate and ceremony use both, and the more unrelated code an agent holds, the easier it is to miss the line that matters. Taphra keeps the ordinary code short: a controller's public properties become the view's variables, a form request's rules are one array, and validated() returns only the fields that have a rule.
Few ways to do each job
Agents imitate the code around them. In a codebase with three ways to validate input, an agent picks one, and it may pick the one that is wrong for this case. Taphra gives each kind of code one home and one shape, and its generators write that shape, so new code looks like the code beside it.
Mistakes should fail early and clearly
Agents work in a loop: change, run, read the error, fix. A clear error at the wrong call shortens that loop; a silent fallback lets the mistake through. Taphra rejects an invalid column name before it builds a query, refuses a URL that names a helper rather than an action, and names the missing handler when a command has none.
A framework an agent can read instead of remember
Agents learned the popular frameworks from years of posts that cover many major versions, and they can mix them up. A new framework has no such memory, and that is a real cost. Taphra answers it by being small: the exact source of the version you installed is in vendor/, short enough for an agent to open and read rather than recall.
None of this is only for agents. Code that an agent can read without guessing is code a new teammate can read without guessing. The rest of this page shows how Taphra does it, and what it cannot do.
New to the public, but not new
Taphra is built for the agent era, but it was not born in it. Its grandfather is WebAlgo, a minimal PHP framework that the people behind Prodacity wrote and used from 2010 to 2020 to build several projects for their clients. Those projects are still running today, and in all the people behind Prodacity have used WebAlgo and Taphra on hundreds of projects.
WebAlgo drew on that senior team's years of building tools on CakePHP, Django, Zend Framework, Symfony and other PHP and Python frameworks. It took what had held up on real projects and stayed small on purpose: one DataStore class per table, and templates written in plain PHP.
Much of Taphra started there. DataStores and their Criteria conditions, the views, layouts and elements (.tpl.php, .lyt.php, .elm.php), cache rules that clear entries when an event fires, widgets, queues, locks and email were all first written for WebAlgo. DataStore::find() still takes the same arguments, in the same order, as it did there.
Taphra 1.0 rebuilt that design for PHP 8.2, with PSR standards, Composer packages, a test suite that runs in CI and safe defaults, then added AI providers, an agent loop and an MCP server. The agent-era parts are new. The design under them spent ten years on client projects first.
Built on packages PHP already runs
Taphra writes its own routing, DataStores, auth, AI layer and MCP server, and leaves the rest to packages that much of the PHP world already depends on. Together they have been installed about 5.7 billion times from Packagist.
| Package | What Taphra uses it for | Installs |
|---|---|---|
| symfony/console | The php taphra command line | 1.29 billion |
| symfony/process | Running commands for the AI app builder | 1.16 billion |
| doctrine/inflector | Plural and singular names in generators | 1.02 billion |
| symfony/yaml | Reading the YAML configuration | 942 million |
| filp/whoops | The error page in development | 509 million |
| predis/predis | Redis connections, cache and queues | 375 million |
| nyholm/psr7 | PSR-7 requests and responses | 320 million |
| phpmailer/phpmailer | Sending email | 126 million |
Each release is tested before it ships: 2,061 tests on each of PHP 8.2, 8.3 and 8.4, a PostgreSQL suite against a real server, static analysis, 266 end-to-end checks of the starters, and the five tutorials followed step by step. Bugs fixed before 1.0 have their own regression tests, 57 files of them.
Review is the bottleneck now
Agents have made writing code cheap. They have not made reviewing it cheaper. Every line an agent adds still needs a person who understands what it does, and the pile of changes waiting for that person grows faster than before.
The risky changes are rarely the ones that fail loudly. Tests catch those. The risky ones work: a string printed without escaping, a query built by joining strings, a form that quietly accepts a field it should not. A reviewer only catches them by knowing where to look.
A framework decides how much a reviewer has to look for. A large, flexible one gives an agent many correct-looking ways to do each job, and the reviewer has to check them all. A small, explicit one gives it few, and the reviewer can check those quickly.
Conventions narrow what an agent can get wrong
In a Taphra app each kind of code has one home and one shape. A table is a DataStore in app/DataStores. Input rules are a form request in app/Requests. The JSON an API returns is an API resource in app/Resources. HTML is a view, wrapped in a layout. When an agent follows those conventions, its code lands where a reviewer expects it and looks like the code around it.
The generators write that shape for it. make:crud creates the four files of a JSON resource and prints the routes to add:
php taphra make:crud Post --table=postsapp/DataStores/PostDataStore.php table mapping, casts, fillable columns
app/Requests/PostFormRequest.php validation rules and authorize()
app/Resources/PostResource.php the shape of the JSON response
app/Controllers/PostCrudController.php index, show, store, update, destroyThe reviewer then reads only the decisions: which rules, which fields, which queries. The plumbing is the same in every resource and does not need reading twice.
The safe path is the short path
Generated code follows the path of least resistance. In Taphra that path escapes output, binds query values and keeps unvalidated input out. Leaving it takes a deliberate, visible step, and those steps are what a reviewer scans for.
| Concern | What the ordinary code does | The line to look for in review |
|---|---|---|
| Environment | An unset or unknown APP_ENV runs the app in production mode. The debug error page only exists in development. | APP_ENV=dev anywhere but a laptop |
| Routing | Only the public methods you declare on a controller can be reached from a URL. The helpers the base class provides cannot. | A new public method on a controller |
| CSRF | The HTML starters' AppController checks the token on every request that is not GET, HEAD or OPTIONS. The API starter authenticates with bearer tokens, which need none. | $autoVerifyCsrf = false |
| HTML output | e() and the form helpers escape what they print; tag(), div(), span() and p() take HTML. Top-level strings reach the view already escaped, and e() never escapes them twice. | new SafeString($html) |
| SQL | Values in conditions, Criteria and the query builder are bound as parameters. Column names and operators are checked, and anything else throws before a query is built. | whereRaw() and the other *Raw() methods |
| Input | validated() and $this->validate() return only the fields that have a rule, and only once they pass it; $fillable limits the columns a DataStore accepts. | $request->all() or $_POST passed to a save |
| Authorisation | A form request's authorize() runs before the action. Policies answer can() and authorize(). | An authorize() that returns true for everyone |
| Cookies | Session cookies are HttpOnly and SameSite=Lax, and Secure over HTTPS. | Cookie settings changed in config |
| MCP over HTTP | The endpoint refuses every request until you set a token or your own check, and it checks the Origin header. | An authorizeMcp() that returns true |
| AI builder | ai:build and ai:fix ask before every file write (including the files generators create) and every command outside an exact allow-list, and never run a shell. | --dontaskforpermissions in a script |
All of these are the defaults in 1.0. A reviewer does not check that each change remembered them; they look for the few lines that turn one off.
Small enough to read end to end
When an agent or a person is unsure what a framework method does, the reliable answer is its source. In Taphra that source is short enough to open and read. An average file holds about 106 lines of code. DataStores are plain classes, with no generated proxy classes to trace through.
taphra/taphra, to scale. It includes the 7 libraries below, and each of them is also published on its own.
| Package | What it holds | Files | Lines of code | All lines |
|---|---|---|---|---|
taphra/taphra |
Core: HTTP and middleware, MVC, auth, queues, cache, events, console, MCP over HTTP, AI app builder | 231 | 22,933 | 42,276 |
taphra/ai |
AI providers, conversations, agent loop, tools, structured output, MCP server over stdio | 60 | 4,694 | 7,781 |
taphra/billing |
Subscriptions, webhooks, Stripe and test providers | 22 | 1,889 | 3,355 |
taphra/container |
PSR-11 container and service providers | 5 | 72 | 191 |
taphra/crypt |
Authenticated encryption with libsodium | 1 | 97 | 185 |
taphra/db |
Connections, query builder, DataStore ORM and schema builder | 43 | 7,808 | 15,293 |
taphra/l10n |
Translations with ICU message formatting | 1 | 692 | 1,200 |
taphra/validator |
Input validation rules | 1 | 363 | 644 |
| Total | 364 | 38,548 | 70,925 |
Composer dependencies such as Symfony Console, Symfony YAML, PHPMailer and the PSR interfaces are not counted. They are listed in the framework's composer.json.
Agents can check their own work
An agent that can verify a change hands over fewer broken ones. Taphra gives it the same tools a person uses.
php taphra route:listprints every route, so a new endpoint is visible.php taphra debug:requestshows the last request, its status and the queries it ran.HttpTestCaseruns a request through the full middleware pipeline in process, with assertions such asassertOk(),assertJsonPath()andassertRedirect().php taphra route:openapiwrites an OpenAPI 3.0 spec from route annotations and form request rules, which an agent can read as context.
class PostApiTest extends HttpTestCase
{
public function testStoreRejectsMissingTitle(): void
{
$this->postJson('/api/posts', ['body' => 'No title'])
->assertUnprocessable();
}
}Built for agents to use, not only to write
The same app an agent helps build can be exposed to agents. Taphra includes an MCP server: mark controller methods with attributes and they become tools, resources and prompts.
use Taphra\Ai\Mcp\McpTool;
class PostsMcpController extends AppMcpController
{
#[McpTool(name: 'find_post', description: 'Fetch a post by its id')]
public function findPost(array $params): ?array
{
return PostDataStore::findById((int) $params['id'])?->toArray();
}
}php taphra mcp:servemcp:serve runs the server over stdio for desktop clients and coding agents, and an MCP controller serves Streamable HTTP. The HTTP endpoint refuses every request until you set a token or your own check, and it checks the Origin header. Protocol revisions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05 are supported. make:mcp Post --from-datastore=PostDataStore generates list, get, create, update and delete tools with input schemas read from the DataStore.
Inside your own code, the same app can call Anthropic, OpenAI, OpenAI-compatible servers or Ollama, stream tokens as they arrive, run an agent loop that calls your tools until it has an answer, and turn a reply into data that matches a JSON schema. Prompt templates keep prompts in files you can review.
A review checklist for Taphra code
Because the safe path looks the same everywhere, review can follow a short list. Use it for changes written by people and by agents alike.
- Does any controller set
$autoVerifyCsrf = false? Why? - Is every new public method on a controller meant to be reachable from a URL?
- Is there any
SafeString? Where does its HTML come from? - Do raw fragments (
whereRaw(),orderByRaw(), the connection'squery()) use?placeholders, with no values joined into the string? - Does each write use
validated()rather thanall()or$_POST? - Does each form request's
authorize()say who may do this? - Do new routes show up in
php taphra route:listas intended? - Is there a test that exercises the change through
HttpTestCase?
What a framework cannot do
Conventions do not catch wrong business logic, and safe defaults do not stop a determined bypass. A reviewer and a test suite are still required. What a small, explicit framework changes is how long a careful review takes and how much of it is spent on the decisions that matter.
Taphra's own AI app builder, ai:build, ships as a preview Preview in 1.0. It asks before every file write (including the files generators create) and before every command outside an exact allow-list, never runs a shell, and keeps a receipt so ai:rollback can undo a session. Its behaviour may change in minor releases.