Command line: bin/ink
| Command | What it does |
|---|---|
php bin/ink serve [port] | development server (default 8000, APP_ENV=dev) |
php bin/ink routes | every URL with its file, param count, methods and login requirement |
php bin/ink check | syntax, page declarations and security rules; exit code 1 on errors |
php bin/ink test [--http=URL] | runs the route tables in tests/*.txt; --http tests a running server |
php bin/ink migrate | applies migrations/*.sql in order |
What check looks for (excerpt)
params()is the first statement andallow()the second;input()/is_post()withoutallow(); optional params plus POST with only oneallow();- POST without
csrf_check()(an error in the admin area, a warning elsewhere;csrf_exempt()states why); pages/admin…withoutrequire_login();- other PHP files in
public/; a committed.env.php; an unwritablestorage/; - a
t()missing a language.
Route tables
tests/app.txt# tests/app.txt
GET / -> 200 pages/index.php []
GET /about.php -> 301 /about
GET /user/42 -> 200 pages/user.php ["42"]
GET /user/01 -> http:404 # decided by the page: checked with --http only
POST /about -> 405
Your own CLI scripts
bin/import-users#!/usr/bin/env php
<?php
// bin/import-users — php bin/import-users users.csv
require __DIR__ . '/../ink/ink.php'; // in the CLI: no headers; uncaught exceptions go to STDERR, exit code 1
$n = 0;
tx(function () use (&$n): void {
foreach (new SplFileObject($GLOBALS['argv'][1]) as $line) {
if (trim((string) $line) === '') continue;
q('INSERT INTO users (name) VALUES (?)', [trim((string) $line)]);
$n++;
}
});
log_info('users imported', ['rows' => $n]);
Run them as the web user (sudo -u www-data php bin/…) and commit large imports in batches.