CLI Commands

Module: Daf CLI

Source: Daf/Commands/CommandRouter.cs, Daf/Services/*

Global Invocation

daf <command> [options]

  • -h / --help or help: show help
  • -v / --version / version: print CLI version

create

Synopsis: daf create <webapp|webapi|cleanwebapp>

Description: Copies template files into current directory, renames root app namespace/folder, writes cli.settings.json.

Side effects: creates app folder, vendor/, index.php; fails if directory is not empty or already initialized.

Related: Project Templates, watch, generate.

generate (alias: g)

Synopsis: daf generate <type> <fullpath> [options]

Types: model, class, controller, api-controller, dbset, migrations, component, view-component, class-component.

Options: -m|--model <modelFullPath> (required for dbset).

Side effects: writes generated PHP/view files under configured base folders from cli.settings.json.

migrations

Synopsis:

  • daf migrations add <name>
  • daf migrations migrate
  • daf migrations rollback

Description: Builds temporary migration entry script, runs PHP process, removes temp file.

Side effects: for add, creates migration class file under <App>/Migrations when generator path is used.

watch

Synopsis: daf watch [--host localhost] [--port 8000] [--ws-port 8181] [--verbose]

Description: starts PHP built-in server, WebSocket live-reload server, browser open, and file watcher for .php/.phar/.html/.css/.js.

Side effects: writes prepend file in vendor/storage/__daf_livereload_prepend.php; starts long-running processes.

download (alias: d)

Synopsis: daf download <core|db|firebase|globals>

Description: downloads package ZIP from configured HTTPS URL, extracts into vendor/, updates dependency entry in cli.settings.json.

update (alias: u)

Synopsis: daf update <core|db|firebase|globals>

Description: re-downloads and overwrites package files under vendor/; ensures dependency entry exists/updated in cli.settings.json.

kill-all

Synopsis: daf kill-all

Description: terminates PHP processes (pkill php on Unix-like; process kill on Windows).

Examples

PHP
# project creation
daf create webapp

# generation
daf generate model Models/User
daf generate dbset DbSets/User -m Models/User

# runtime workflow
daf watch --host localhost --port 8000 --ws-port 8181 --verbose

# migrations
daf migrations add CreateUsersTable
daf migrations migrate

# packages
daf download core
daf update db