inkphp GitHub 中文

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

  1. One URL is one file. That file holds everything the feature needs: accepted params, methods, auth, CSRF, validation, SQL, HTML, form and htmx handling.
  2. 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.
  3. Safe by default. e() escaping, parameterized SQL only, one-line CSRF, local-only redirects, page files outside the docroot.
  4. Small enough to read in one go. ~1000 lines, 45 public functions, one AGENTS.md contract.
  5. Zero dependencies, no build. No Composer, no npm. Upload or git pull and 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.