inkphp documentation
inkphp is a small PHP framework built around one idea: one URL = one file = one feature. It is designed for having AI agents write and change your code — and it is just as simple for people.
Five principles
- One URL is one file. That file holds everything the feature needs: accepted params, methods, auth, CSRF, validation, SQL, HTML, form and htmx handling.
- Nothing runs that the page didn't call. No middleware, guard files, autoloading or source scanning. Every dependency is a visible call in the page.
- Safe by default.
e()escaping, parameterized SQL only, one-line CSRF, local-only redirects, page files outside the docroot. - Small enough to read in one go. ~1000 lines, 45 public functions, one
AGENTS.mdcontract. - Zero dependencies, no build. No Composer, no npm. Upload or
git pulland it runs on PHP 8.2+.
Layout
myapp/
├── pages/ URL = file (outside the docroot)
├── layouts/ page frames, used only via layout('name')
├── lib/ shared business functions, explicitly require_once'd
├── migrations/ NNN_name.sql, applied by bin/ink migrate
├── public/ the docroot: index.php + assets only
├── ink/ the kernel (vendored, pinned)
├── storage/ logs, sessions, rate-limit counters
├── config.php settings (no secrets) · .env.php secrets (not in git)
├── bin/ink serve / routes / check / test / migrate
└── AGENTS.md the complete contract for AI agents
Next: Quick start · Working with AI. More pages are in Chinese for now.