Taphra documentation
These guides cover Taphra 1.x for PHP 8.2 and later, in the order you are likely to need them. Each page covers one topic and links to the others where they meet. Examples use the layout of the taphra/skeleton starter.
Start here
#- Getting started: requirements, installing a new app, the skeleton's layout, a first page and a first JSON endpoint.
- Configuration and environments: the YAML files, environment sections,
APP_ENV, secrets and the settings that matter in production.
Building an app
#- Routing and controllers:
routes.yml, named routes, route groups and middleware, routes from packages, controller actions and their helpers. - Views and helpers: templates, layouts, elements, escaping, forms and the HTML helpers.
- Requests and validation: reading input, uploads, the validator and form requests.
- REST APIs: JSON controllers, CRUD controllers, API resources and OpenAPI output.
Data
#- Database: connections, migrations (from more than one folder), foreign keys, seeders and factories, transactions, and which query API to use.
- DataStores: one class per table, the query builder, casts, relations, scopes, hooks and pagination.
- SqlQuery: the query builder for joins, sub-queries, CTEs, window functions, upserts and raw SQL with bindings.
Security
#- Authentication: sessions, remember-me, password hashing, JWT, two-factor codes and policies.
- Security: CSRF, cookies and sessions, escaping, encryption, rate limiting, the defaults, and a production checklist.
AI
#- AI: providers, streaming, structured output, tools and the agent loop, conversations and prompt templates.
- MCP server: exposing tools, resources and prompts to MCP clients over stdio and HTTP.
- AI builder:
ai:build,ai:fixandai:rollback(a preview feature).
Application services
#- Queues: jobs, drivers and workers.
- Cache: cache drivers, the cache API and locks.
- Events: emitting and listening to events.
- Scheduler: recurring tasks from one cron entry.
- Email: transports, templates with placeholders, attachments, and sending from a queue job.
- Localisation: translations, plural rules, the locale middleware and
lang:scan. - Billing: customers, subscriptions and webhooks with Stripe.
Architecture
#- Service container and providers: bindings, autowiring and service providers.
- Logging and debugging: log drivers and levels, request IDs, the request log and the REPL.
Testing and operations
#- Testing: in-process HTTP tests (JSON, HTML pages and redirects, raw bodies), a database in tests and faking AI providers.
- Command line: every
php taphracommand. - Deployment: php-fpm, FrankenPHP worker mode,
php taphra optimize, workers and cron. - Upgrading: the version policy, upgrade notes (1.0.0 to 1.0.1, 1.0.1 to 1.0.2, 1.0.2 to 1.1.0) and moving from pre-release copies to 1.0.
Tutorials
#Step-by-step builds of small apps:
Reference
#- How Taphra compares with Laravel, Symfony and others.
- Changelog.
- The bundled libraries, usable without the framework: db, validator, container, crypt, l10n, ai, billing.
Found a mistake in these pages? Open an issue or a pull request; CONTRIBUTING.md explains how.