Features
What ships in Taphra 1.1.0. Every item on this page was checked against the release source. The AI app builder ships as a preview.
Web and HTTP
- Controllers, views, layouts, elements
- Routes map URLs to
controller/action, and only the public methods you declare can be reached from a URL. Properties you set on the controller become variables in the view. Views are plain PHP templates wrapped in layouts, with reusable elements and named blocks. - Routing
- Routes in
routes.yml, route groups with a shared prefix and middleware, androute:listto print them. - PSR-7 and PSR-15
- A middleware pipeline with request IDs, CORS, JSON and form body parsing, rate limiting, security headers, auth, content negotiation, locale detection and error pages built in.
- PSR-11 container
- Singleton bindings by default and service providers with a register phase and a boot phase, discovered from
app/Providersor listed in config. - Forms
- A form helper that binds a record to its fields, refills old input after failed validation, shows errors next to fields, adds a CSRF token and renders pagination links.
- HTMX helpers
isHtmx(),renderPartial(),htmxRedirect(),htmxPushUrl(),htmxTriggerEvent()and the other HTMX request and response headers.- Server-Sent Events
$this->sse()streams any generator or callable and handles the headers and flushing.- Widgets
- Server-rendered widgets, and mount points that hand props to a React, Vue or Svelte component for an islands layout.
- Sessions and cookies
- File or database sessions. Session cookies are HttpOnly and SameSite=Lax, and Secure over HTTPS.
Data
- DataStore ORM
- Active-record style tables on MySQL and MariaDB, PostgreSQL, SQLite and SQL Server. Relations (has many, has one, belongs to, many to many, has many through, polymorphic), eager loading, scopes, global filters, soft deletes, timestamps, casts and JSON column queries.
- Query builder
- Joins, common table expressions including recursive ones, window functions, UNION, INTERSECT and EXCEPT, upserts written in each database's own syntax, RETURNING on PostgreSQL and SQLite, row locks, and raw fragments with bound parameters. Column names and operators are checked before a query is built.
- Schema builder and migrations
- Portable DDL with more than 20 column types, including
json,jsonb,uuid,vectorfor pgvector andtsvector; partial and GIN indexes; foreign keys; generated columns.migrate:diffreports drift between DataStores and the live schema. - Seeders and factories
- Fill a database for development and tests with
db:seedand factory definitions. - Pagination and listings
paginate()and a list query that reads search, sort and page parameters from the request.- Batch writes and transactions
insertBatch()andupsertBatch()with chunking;DataStore::transaction()on a shared connection.- Query log
- In development every query is logged with its timing, and repeated patterns are flagged as possible N+1 queries.
APIs
- REST controllers
json(),created(),noContent(), andapiError()for RFC 7807 problem details.- Form requests
authorize()runs before the action;validated()returns only the fields that have rules, and refuses input that fails them with a 422.- API resources
- One class decides the shape of a record in a response, for single items and collections.
- CRUD controller
- Name a DataStore, a form request and a resource, and get index, show, store, update and destroy with search, sorting, pagination and lifecycle hooks.
make:crud- Generates the DataStore, form request, resource and controller for a table and prints the routes to add.
- OpenAPI
route:openapiwrites an OpenAPI 3.0.3 spec, in YAML or JSON, from route annotations and form request rules.
Auth and security
- Session and JWT auth
- One auth API over a session driver or a JWT driver. JWTs carry an id and expiry and can be revoked.
- Two-factor authentication
- TOTP codes that work with common authenticator apps, protected against replay, plus single-use backup codes.
- Remember-me
- Long-lived login tokens, with optional rotation each time one is used.
- Password reset and email verification
- Expiring tokens kept in the cache, with no extra tables.
- Policies
- Per-resource authorisation classes, with
can()andauthorize()helpers in controllers. - Safe defaults
- An unset or unknown
APP_ENVruns in production and the debug page only exists in development. The HTML starters check a CSRF token on every request that is not GET, HEAD or OPTIONS (the API starter uses bearer tokens instead).e()and the form helpers escape, values in conditions and the query builder are bound (raw SQL goes through methods named*Raw()), and an HTML sanitiser keeps a safe subset of user-written HTML. - Request protection
- A security headers middleware, trusted proxy settings, and a rate limiter backed by Redis or files.
- Passwords and encryption
- Argon2id hashing (bcrypt where PHP lacks it) with rehash detection, and authenticated encryption with libsodium through
taphra/crypt.
Background work and infrastructure
- Queues
- Redis, database and Beanstalkd drivers, or your own.
queue:workretries with exponential backoff, runs several workers in parallel and stops cleanly on SIGTERM. Failed jobs are logged and dropped after the last retry;queue:faileddoes not list them yet. - Scheduler
- Define recurring tasks in PHP and run them all from one cron entry.
- Cache
- File, APCu, Memcache and Redis backends,
remember(), and entries that clear themselves when a named event fires. - Events
- A synchronous event bus with wildcard listeners.
- PHPMailer with HTML and plain-text templates, SMTP or sendmail, and sending through the queue.
- Command and query bus
- Explicit handler registration with optional middleware.
- Locks and logging
- File or database locks. PSR-3 logging to files, syslog or nowhere, with a request ID on every line.
- Localisation
taphra/l10nwith dot-notation keys or source text as keys, ICU message formatting through intl and a built-in plural fallback, andlang:scanto find missing translations.
Billing
- Subscriptions
- A
Billabletrait for users or teams: subscribe, trials, cancel at period end, status checks. - Providers and webhooks
- Stripe through its REST API with no SDK, webhooks turned into framework events, and a null provider for tests. Other providers implement one interface.
AI and agents
- Providers
- Anthropic; OpenAI, with the Responses API for reasoning models and Chat Completions otherwise; OpenAI-compatible servers; Ollama. One interface for completions, token streaming and embeddings.
- Conversations
- Multi-turn history stored in the session, the cache or memory, trimmed to fit the context window, with image messages.
- Agent loop and tools
- Run a model with your tools until it has an answer. Tools are small classes with a JSON schema;
make:toolscaffolds one. - Structured output
- Turn a reply into data that matches a JSON schema.
- Prompt templates
- Prompts kept in files under
app/Prompts, filled with variables, scaffolded bymake:prompt. - Fallback and caching
- Try providers in order, and cache identical completions.
- DataStore traits
- Semantic search over embeddings and on-demand summaries for any DataStore.
- MCP server
- Mark controller methods with
#[McpTool],#[McpResource]and#[McpPrompt]. Serve them over stdio withphp taphra mcp:serveor over Streamable HTTP, protocol revisions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05.make:mcp --from-datastoregenerates typed CRUD tools. - MCP over HTTP, closed by default
- The HTTP endpoint refuses every request until you set a token or your own check, and refuses browser origins you have not allowed.
- AI app builder Preview
ai:buildscaffolds an app from a description andai:fixproposes a fix for an error. Both ask before every file write (including the files generators create) and every command outside an exact allow-list, never run a shell, andai:rollbackundoes a session. Behaviour may change in minor releases.
Performance and deployment
optimize- Compiles configuration, routes and translations into PHP arrays and writes an opcache preload script.
optimize:clearremoves them. - FrankenPHP worker mode
- The skeleton ships a worker entry point that boots once and resets per-request state, and falls back to single requests under PHP-FPM.
- Health endpoint
- The skeleton answers
GET /healthwith JSON, for load balancers and container checks. - Docker
make:dockerfilegenerates a Dockerfile and compose file; the starter apps include them.- Configuration
- YAML files with dot-notation access and
${ENV}placeholders in AI config. Cache, sessions, logging, queue, auth and mail drivers change with one config value.
Developer tools
- Command line
- Symfony Console with
serve,setup,migrate,db:seed,route:list,queue:work,schedule:run,tinker,debug:request,key:generateand more. - 21 generators
make:controller,make:datastore,make:model,make:migration,make:crud,make:api-resource,make:auth,make:policy,make:middleware,make:provider,make:command,make:handler,make:console,make:helper,make:seeder,make:factory,make:test,make:mcp,make:tool,make:prompt,make:dockerfile.- Testing
HttpTestCaseruns requests through the full middleware pipeline in process, with status, header, body and JSON assertions, plus a database for tests and fake AI providers. Works with PHPUnit and Pest.- Debugging
- Whoops error pages with request, SQL, route and config panels; optional Clockwork integration;
dump()anddd().
Standalone packages
taphra/taphra includes seven libraries: db, validator, container, crypt, l10n, ai and billing. Each is also published on its own, with no dependency on the framework, so you can use it in a Laravel, Symfony or Slim app or in a plain script.
composer require taphra/taphra # the framework, with all seven
composer require taphra/db # one library on its owntaphra/db- Connections, query builder, DataStore ORM and schema builder. Needs PDO and psr/log. Packagist
taphra/validator- Input validation with more than 20 rules and custom rules. Needs mbstring. Packagist
taphra/ai- AI providers, conversations, agent loop, tools, structured output and the stdio MCP server. Needs curl. Packagist
taphra/billing- Subscriptions and webhooks. Uses taphra/db and taphra/container. Packagist
taphra/container- PSR-11 container and service providers. Packagist
taphra/crypt- Authenticated encryption with libsodium. Packagist
taphra/l10n- Translations with ICU message formatting. Packagist