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.

Third-party packages Taphra uses, what for, and their installs on Packagist
PackageWhat Taphra uses it forInstalls
symfony/consoleThe php taphra command line1.29 billion
symfony/processRunning commands for the AI app builder1.16 billion
doctrine/inflectorPlural and singular names in generators1.02 billion
symfony/yamlReading the YAML configuration942 million
filp/whoopsThe error page in development509 million
predis/predisRedis connections, cache and queues375 million
nyholm/psr7PSR-7 requests and responses320 million
phpmailer/phpmailerSending email126 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:

Terminal
php taphra make:crud Post --table=posts
Files created
app/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, destroy

The 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.

What the ordinary code does, and what opting out looks like
ConcernWhat the ordinary code doesThe line to look for in review
EnvironmentAn 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
RoutingOnly 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
CSRFThe 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 outpute() 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)
SQLValues 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
Inputvalidated() 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
AuthorisationA form request's authorize() runs before the action. Policies answer can() and authorize().An authorize() that returns true for everyone
CookiesSession cookies are HttpOnly and SameSite=Lax, and Secure over HTTPS.Cookie settings changed in config
MCP over HTTPThe 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 builderai: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.

38,548 lines of code in taphra/taphra, to scale. It includes the 7 libraries below, and each of them is also published on its own.
Lines of code per package
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:list prints every route, so a new endpoint is visible.
  • php taphra debug:request shows the last request, its status and the queries it ran.
  • HttpTestCase runs a request through the full middleware pipeline in process, with assertions such as assertOk(), assertJsonPath() and assertRedirect().
  • php taphra route:openapi writes an OpenAPI 3.0 spec from route annotations and form request rules, which an agent can read as context.
test/PostApiTest.php
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.

app/Controllers/PostsMcpController.php
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();
    }
}
Terminal
php taphra mcp:serve

mcp: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's query()) use ? placeholders, with no values joined into the string?
  • Does each write use validated() rather than all() or $_POST?
  • Does each form request's authorize() say who may do this?
  • Do new routes show up in php taphra route:list as 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.