The console

The framework should explain your application, not just run it

The CLI is first-class, not an afterthought. A runtime feature is not finished until something can show it — if routing gains a capability, tether routes gains a column.

php tether help
php tether help <command>

Understanding an application

php tether routes                 # every registered route, and what wraps it
php tether explain /posts/12      # resolve one URL the way a request would
php tether inspect Actions\Post\Show
php tether context                # the whole application as JSON

routes flags any route whose Action is missing or not routable — a 500 nobody would otherwise see until someone requested it — and lists the middleware every route passes through.

explain walks one URL through the pipeline: the middleware it passes, the route it matches, the parameters it captures, the query string the Action receives, and the Action, Domain, Result and Responder behind it. Where a link is a naming convention it says so, and where it read the answer out of the code it says that too.

context writes JSON to stdout and nothing else, so it can be piped. It carries the routes, the ADR triples, the commands, the directories and the conventions that are otherwise folklore — which is what an agent needs in order to place a new feature without guessing.

Generating code

php tether make:feature Blog                  # one page, whole triple
php tether make:resource Post --uri=/posts    # seven, a whole CRUD resource
php tether make:action Blog Show              # add one operation to a feature

The three piecemeal generators take a feature and an operation, and default the operation to Index. They warn when the class they just wrote refers to one that does not exist yet, which is a legitimate thing to do — the others may be coming — but should never be silent.

Explicit code costs typing. That is the correct trade only because the generators write the explicit parts, and what runs is still exactly what you can read. See CRUD.

Running things

php tether serve                  # PHP's built-in server
php tether test                   # your application's PHPUnit
php tether boilerplate:clear      # remove the shipped home page

test forwards to your own PHPUnit rather than vendoring a runner into the framework.

Exit codes are part of the interface

Every command returns a real exit code, so a script or a CI job can tell success from failure. A command that cannot be registered — a misnamed class, a missing autoload mapping, a duplicate name — is reported to stderr with the reason rather than silently vanishing from the list.

Every command

Generated from tether context rather than written by hand, because a list of commands maintained in two places is a list that goes stale — this page spent three releases claiming the framework had two.

boilerplate:clear

Clears all the boilerplate files from the project

tether boilerplate:clear [--force]

Options

  • --force — Skip the confirmation prompt

context

Emit a machine-readable map of the application as JSON

tether context [--pretty]

Options

  • --pretty — Indent the JSON for reading

explain

Show the path a URI takes through the pipeline

tether explain <uri> [--method]

Arguments

  • uri — The URI to resolve, e.g. /blog/hello

Options

  • --method — The HTTP method to resolve as (default GET)

help

Displays help

tether help <command>

Arguments

  • command — Show the arguments and options for one command

inspect

Say what a class is in ADR terms and what it depends on

tether inspect <class>

Arguments

  • class — A class name, short (Home) or fully qualified (Actions\Home)

make:action

Create an Action inside a feature

tether make:action <feature> <operation>

Arguments

  • feature — The feature the action belongs to, e.g. Blog
  • operation — What the action does, e.g. Show (default: Index)

make:command

Create a new command

tether make:command <name>

Arguments

  • name — The name of the command

make:domain

Create a Domain inside a feature, and the Result it returns

tether make:domain <feature> <operation>

Arguments

  • feature — The feature the domain belongs to, e.g. Blog
  • operation — What the domain does, e.g. Show (default: Index)

make:feature

Create a whole ADR triple: Action, Domain, Result, Responder and view

tether make:feature <name>

Arguments

  • name — The name of the feature

make:resource

Create a full CRUD resource: seven Actions, Domains, Results, Responders and their views

tether make:resource <name> [--uri]

Arguments

  • name — The name of the resource, singular, e.g. Post

Options

  • --uri — The base URI to generate routes and redirects for (default: the name, kebab-cased)

make:responder

Create a Responder inside a feature, and the view it renders

tether make:responder <feature> <operation>

Arguments

  • feature — The feature the responder belongs to, e.g. Blog
  • operation — What the responder renders, e.g. Show (default: Index)

routes

Show the resolved route table

tether routes [--method]

Options

  • --method — Only routes registered for this method

serve

Run the application on PHP's built-in server

tether serve [--host] [--port]

Options

  • --host — Host to bind (default 127.0.0.1)
  • --port — Port to bind (default 8000)

test

Run the application's test suite

tether test

If that list disagrees with your install, yours is right and this is stale. The framework knows its own commands; run php tether help.