StackCTL's CLI

Last updated: 04/17/2026 · Written by Agent0

Stack CLI

StackCTL includes a command-line tool called stack that lives in the build/ directory. It handles the repetitive parts of development — scaffolding controllers, views, migrations, and full CRUD resources — so you can focus on the logic that's unique to your app.

All commands are run from your project root:

php stack {command}

To see a list of all available commands at any time:

php stack help

Scaffolding Commands

create:resource

The most powerful command in the CLI. Scaffolds an entire CRUD feature in one step — controller, index view, form view, migration, and printed route suggestions.

php stack create:resource articles

This creates:

  • app/Controllers/ArticlesController.php — with index(), form(), save(), and delete() methods pre-built
  • resources/views/app/articles/index.php — a table view with edit and delete actions
  • resources/views/app/articles/form.php — a create/edit form that handles both modes
  • build/database/XXX_create_articles.php — a migration with standard columns pre-filled

After running, the CLI prints the suggested routes to paste into your routes/web.php.

create:page

Adds a single view file using dot notation. If a matching controller already exists, it automatically injects the new method into it.

php stack create:page articles.adminArticle

This creates resources/views/app/articles/adminArticle.php and injects an adminArticle() method into ArticlesController if it exists. It also prints the suggested route to add.

create:controller

Creates a standalone controller with a basic index() method.

php stack create:controller Reports

This creates app/Controllers/ReportsController.php.


Database Commands

db:create

Creates a new migration file with a sequentially numbered filename.

php stack db:create add_status_to_articles

This generates build/database/007_add_status_to_articles.php (numbered based on existing files) with an up and down function ready to fill in.

db:apply

Runs all pending migrations that haven't been applied yet. Safe to run multiple times — already-applied migrations are tracked and skipped.

php stack db:apply

db:rollback

Rolls back a specific migration by filename, running its down() function and removing it from the migration log.

php stack db:rollback 007_add_status_to_articles.php

db:status

Displays the status of all migration files — showing which have been applied and which are pending.

php stack db:status

db:describe

Prints the column structure of a database table — a quick way to inspect a table without opening a database client.

php stack db:describe users

Package Commands

packages:status

Shows all optional packages configured in config/packages.php and whether each one is currently installed.

php stack packages:status

packages:install

Lists uninstalled optional packages interactively and installs whichever ones you select via Composer.

php stack packages:install

Email Commands

email:test

Sends a test email to verify your SMTP configuration. If mail settings are incomplete, the CLI will prompt you to fill them in first.

php stack email:test -to=you@example.com

email:config

Opens an interactive prompt to review and update your SMTP settings, then saves them to config/mail.php.

php stack email:config
Was this helpful?