Core Commands

Setup, database, cache, and maintenance tooling provided out of the box.

Category: CLI & Tooling

Setup & environment #

Command Summary Notable options
install [--force] Guided installer that copies .env, creates storage/content/theme directories, runs SQL migrations, and drops sample pages. Prompts before overwriting an existing install. --force skips the safety prompt.
version Prints VelvetCMS + module versions, release date, PHP version, OS, and warns when running a dev build.
serve [--host=localhost] [--port=8000] Thin wrapper around php -S rooted at public/. Shows the URL and waits until you Ctrl+C. --host, --port.

Database & content #

Command Summary Notable options
migrate [--force] [--path=] Executes .sql files via the injected MigrationRunnerInterface. In production it asks for confirmation unless --force is passed. You can point to multiple directories using comma-separated --path. --force, --path="modules/foo/database/migrations".
page:make <slug> Creates a Markdown page (content/pages/{slug}.md}) with optional interactive wizard. --title, --interactive.
page:list [--status=published] Dumps the pages table with slug/title/status/updated time. Filters via --status. --status=draft.
page:publish <slug> Loads a page via PageService, flips it to published, sets timestamps, saves, and clears caches.
page:delete <slug> [--force] Deletes a page after confirmation. Use --force to skip the prompt. --force.

Scaffolding & Development #

Command Summary
make:controller <name> Generates a new controller class in src/Http/Controllers.
make:model <name> Generates a new model class in src/Models.
make:command <name> Generates a new console command in src/Commands.
make:middleware <name> Generates a new middleware class in src/Http/Middleware.

Module management #

Command Summary
module:list Uses ModuleManager::discover() to print manifests from config paths, globbed directories, and Composer packages. Shows version, description, path, and dependency requirements.
module:enable <name> Adds the module to storage/modules.json (the source of truth for what should be compiled). Reminds you to run module:compile.
module:disable <name> Removes the module from storage/modules.json. Doesn’t delete files—just toggles state.
module:compile Validates enabled modules, resolves load order, writes storage/modules-compiled.json, and generates storage/modules-autoload.php. Verifies that each manifest’s entry class autoloads correctly.

Configuration & cache #

Command Summary
config:cache Reads every config/*.php, merges them, and writes storage/cache/config.php via ConfigRepository::cacheTo().
config:clear Deletes the cached config file using ConfigRepository::clearCache().
cache:clear Recursively removes everything under storage/cache. Useful before deployments or when switching drivers.
route:cache Executes routes/web.php to compile patterns, then writes the serialized definition array into storage/cache/routes.php. Used by public/index.php for instant routing.
route:clear Deletes storage/cache/routes.php.

Diagnostics & optimization #

Command Summary
diagnose [--json] Performs cache read/write tests, checks storage permissions, pings the database, inspects the active content driver, and counts loaded modules. Outputs either a JSON blob or a pretty table.
optimize Three-step production prep: clears cache, preloads configuration into storage/cache/config.php, and warns if you forgot to switch APP_ENV to production (anything else is considered local) or if APP_DEBUG stayed on. Includes a short deployment checklist.

All of these commands are safe to run multiple times—they’re idempotent and log what they changed so you can script them into CI/CD pipelines.