Download the PHP package trk/processwire-console without Composer
On this page you can find all versions of the php package trk/processwire-console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download trk/processwire-console
More information about trk/processwire-console
Files in trk/processwire-console
Package processwire-console
Short Description A professional CLI tool for ProcessWire CMS.
License MIT
Informations about the package processwire-console
ProcessWire Console
vendor/bin/wire
A professional CLI for ProcessWire CMS/CMF.
57 production-ready commands · JSON output for AI agents · Composer-driven extensibility
Table of Contents
- Why ProcessWire Console?
- Installation
- Shell Alias (Recommended)
- Quick Start
- Command Reference
- Pages
- Fields
- Templates
- Modules
- Users & RBAC
- Cache
- Logs
- Database & Backup
- Scaffolding
- Migrations
- Queues
- Database Seeding
- Testing
- Task Scheduling
- Maintenance Mode
- Tinker (REPL)
- JSON Output (Machine-Readable)
- Interactive Mode
- Extending the Console
- Security
- Architecture
- Requirements
- License
Why ProcessWire Console?
ProcessWire is a powerful CMF but lacks a first-party CLI. This package fills that gap with 57 production-ready commands purpose-built for ProcessWire's architecture:
| Domain | Commands | Description |
|---|---|---|
| Content (Pages) | 8 commands | Create, update, publish, move, trash, restore |
| Schema (Fields) | 7 commands | List, info, create, update, rename, attach, detach |
| Schema (Templates) | 6 commands | List, info, create, update, rename, reorder fields |
| Modules | 5 commands | List, install, uninstall, refresh, upgrade |
| Users & RBAC | 11 commands | Users, roles, permissions management |
| Cache & Logs | 7 commands | Clear caches, list/read/tail/clear log files |
| Database | 4 commands | Backup, restore, list backups, purge old backups |
| Scaffolding | 5 commands | Generate modules, migrations, queues, seeders, schedules |
| Migrations | 8 commands | Run, rollback, reset, refresh, fresh, status |
| Queues | 5 commands | Work, failed, retry, clear, initialize tables |
| Seeding | 1 command | Populate the database with test data |
| Scheduling | 1 command | Run due scheduled tasks |
| Maintenance | 2 commands | Put the application up or down |
| Runtime | 2 commands | Interactive REPL, command listing |
| Testing | 2 commands | Run tests, scaffold test files |
| Total | 73 commands |
Every command supports --json for machine-readable output, --dry-run for safe previews, and --force for non-interactive scripting.
Installation
A wire symlink is created at your project root automatically. If it isn't, run:
Verify Installation
If the database is not configured, the CLI will still start and display command help. Full functionality requires a working ProcessWire installation with database access.
Shell Alias (Recommended)
Typing php vendor/bin/wire every time is tedious. Set up a shell alias to use just wire:
macOS / Linux (Bash/Zsh)
Add this line to your shell config file (~/.zshrc, ~/.bashrc, or ~/.bash_profile):
For Bash users, replace
~/.zshrcwith~/.bashrc.
Windows (PowerShell)
Run in PowerShell to add a persistent alias:
Windows (CMD)
Create a wire.bat file in a directory that's in your PATH:
After Setup
Now you can use wire directly:
Quick Start
Command Reference
Pages
Manage the ProcessWire page tree — create, update, publish, move, trash, and restore pages.
page:list
List pages with filtering, sorting, and pagination.
Options:
| Option | Short | Description |
|---|---|---|
--template |
-t |
Filter by template name |
--parent |
-p |
Filter by parent path or ID |
--sort |
-s |
Sort field (default: -created). Prefix with - for descending |
--limit |
-l |
Number of results (default: 20) |
--include |
-i |
Include scope: all, hidden, unpublished (default: all) |
--json |
Output as JSON |
page:find
Find pages using a raw ProcessWire selector string.
Options:
| Option | Description |
|---|---|
selector |
Argument: ProcessWire selector string (required) |
--json |
Output as JSON |
page:create
Create a new page under a parent with a specific template.
Options:
| Option | Short | Description |
|---|---|---|
--parent |
-p |
Parent page path or ID (required) |
--template |
-t |
Template name (required) |
--title |
Page title | |
--name |
URL-safe name (auto-generated from title if omitted) | |
--unpublished |
Create as unpublished | |
--interactive |
-i |
Prompt for all values including template field filling |
--dry-run |
Preview changes without saving | |
--json |
Output as JSON |
page:update
Update page properties and field values.
Options:
| Option | Description |
|---|---|
--id |
Page ID (required; or use --path) |
--path |
Page path (alternative to --id) |
--title |
New title |
--name |
New URL-safe name |
--parent |
New parent path or ID |
--template |
Change template |
--status |
Status: published, unpublished, hidden, locked |
--set |
Set field value as key=value (repeatable) |
--dry-run |
Preview without saving |
--json |
Output as JSON |
page:publish / page:unpublish
page:trash / page:restore
page:move
Fields
Full lifecycle management for ProcessWire fields.
field:list
field:info
field:update
field:rename
field:attach / field:detach
field:delete
Templates
template:list
template:info
template:update
template:rename
template:fields:reorder
template:delete
Modules
A complete module lifecycle manager — discover, install, enable, disable, upgrade.
module:list
module:install / module:uninstall
module:refresh
module:upgrade
Users & RBAC
Complete role-based access control management from the command line.
Users
Roles
Permissions
Cache
cache:clear
Clears compiled files, session caches, and file caches.
cache:wire:clear
Clear WireCache entries by exact key or SQL LIKE pattern.
Logs
log:list
List all available log files.
log:read
Retrieve and display ProcessWire logs as a formatted table.
log:tail
Read the last N lines of a log file and follow output.
log:clear
Clear a specific log file.
log:clear-all
Clear all ProcessWire log files.
Database & Backup
db:backup
Create a database backup using ProcessWire's native WireDatabaseBackup.
db:restore
Restore the database from a backup file.
Warning: This operation replaces your entire database. Always back up before restoring.
backup:list
backup:purge
Remove old backup files, keeping only the most recent N backups.
Scaffolding
make:module
Scaffold a new ProcessWire module from a professional stub.
Module types and stubs:
| Type | Base Class | Use Case |
|---|---|---|
module |
WireData |
General-purpose module with init/ready hooks |
fieldtype |
Fieldtype |
Custom database field storage |
inputfield |
Inputfield |
Custom form input widget |
process |
Process |
Admin page with URL routing |
make:migration
Scaffold a new timestamped migration file. See Migrations for full documentation.
Migrations
A complete migration system for ProcessWire — schema versioning with up/down methods, batch tracking, rollback support, and 7 typed stubs for common PW operations.
Migrations live in site/migrations/ and are tracked in the wire_migrations database table (auto-created on first run).
make:migration
Generate a new timestamped migration file from a stub.
Stub types:
--type |
Generates | up() | down() |
|---|---|---|---|
blank |
Empty skeleton (default) | — | — |
create-field |
Field creation | new Field() + save |
delete field |
create-template |
Template + fieldgroup + file | Full scaffold | delete template + file |
attach-field |
Field-to-template attachment | fieldgroup add | fieldgroup remove |
create-page |
Page creation | new Page() + save |
delete page |
create-role |
Role + permission grants | roles add + grant | delete role |
install-module |
Module install | modules->install() |
uninstall |
Dependency Order (Critical)
ProcessWire objects have strict dependency chains. Migrations must respect this order:
For a typical blog setup, the correct migration sequence is:
On rollback, these run in reverse order (last-in-first-out) — pages deleted before templates, fields detached before being deleted.
Safe-by-Default Guards
All stubs include precondition guards in down() that throw clear errors instead of cascading destructive operations:
| Stub | Guard | Error |
|---|---|---|
create-field |
Field attached to template(s)? | "Cannot delete — detach first" |
create-template |
Pages using this template? | "Cannot delete — remove pages first" |
attach-field |
Pages have data in this field? | "Cannot detach — data would be lost" |
create-page |
Page has children? | "Cannot delete — remove children first" |
create-role |
Users assigned this role? | "Cannot delete — remove from users first" |
install-module |
Other modules depend on it? | "Cannot uninstall — dependencies exist" |
make:queue
Generate a new file-based Queue class in ProcessWire Console.
Options:
| Option | Short | Description |
|---|---|---|
name |
Class name ending with Queue (required) | |
--module |
-m |
Placed inside site/modules/YourModule/queue/ |
Design philosophy: Stubs never auto-delete user content or cascade-remove dependencies. They fail loudly so you can write the correct cleanup migration yourself.
Each migration file returns an anonymous class with up() and down() methods:
migrate
Run all pending migrations.
migrate:rollback
Rollback the last batch of migrations (calls down() in reverse order).
migrate:reset
Rollback ALL applied migrations.
migrate:refresh
Reset + re-run all migrations (shortcut for reset then migrate).
migrate:fresh
Drop the tracking table entirely and re-run all migrations from scratch.
Warning:
migrate:freshdoes not calldown()— it drops the tracking table and re-applies all migrations. Usemigrate:refreshif you need clean rollbacks.
migrate:status
Show the status of all migration files in a formatted table.
Output example:
migrate:install
Explicitly create the wire_migrations tracking table (auto-created by migrate if missing).
Version
Show the active version of ProcessWire, processwire-console, and associated ecosystem packages like processwire-boost.
Queues
ProcessWire Console offers a lightweight, file-based Queue Management System that automatically discovers *Queue.php classes.
queue:table
Create the database tables (queue_jobs and failed_jobs) required to store queue data.
queue:work
Start the queue worker daemon to process background jobs continually.
Options:
| Option | Description |
|---|---|
--queue |
Name of the queue. Default: default |
--sleep |
Seconds to wait before polling again if empty. Default: 3 |
--tries |
Attempts before a job fails. Default: 3 |
queue:failed
List recent failed jobs cleanly in a table.
queue:retry
Push a failed job back onto the queue for processing, or bulk retry all.
queue:clear
Wipe all logs from the failed_jobs database.
Database Seeding
Populate your database with initial data or fake data using ProcessWire Console.
Tip: If you need fake data generation, it is highly recommended to install Faker via
composer require fakerphp/faker. The base Seeder class will automatically inject a Faker instance for you to use via$this->faker. You can also just parse local JSON files natively.
make:seeder
Generate a new seeder stub.
db:seed
Run the database seeders. It auto-discovers seeders in site/seeders/ and site/modules/*/seeders/.
Testing
ProcessWire Console integrates Pest PHP natively to bring beautiful, modern Test-Driven Development (TDD) to ProcessWire.
Tip: If Pest is not installed on your system when you run the
testcommand, the console will detect it and elegantly prompt you to install it and automatically scaffold thetests/Pest.phpconfig.
Our intelligent FeatureDiscoverer auto-magically locates all Pest tests placed in:
/tests//site/tests//site/modules/[AnyActiveModule]/tests/
...and runs them holistically via a single command!
make:test
Generate a new Pest test stub.
test
Run your Pest test suite. You can pass forward any native Pest arguments (e.g., --filter, --parallel).
Task Scheduling
Manage scheduled, recurring tasks from a single cron entry using dragonmantank/cron-expression.
Cron Configuration: Add a single entry to your server's crontab that runs every minute:
make:task
Generate a new scheduled task stub.
schedule:run
Evaluate and run any scheduled tasks that are currently due.
Maintenance Mode
Easily put your application into a maintenance or disabled state.
Requirement: For ProcessWire to respond to this state, update site/init.php to check for site/assets/down.json. (See the Boost pw-maintenance skill for a code snippet).
down
Put the application into maintenance mode.
up
Bring the application out of maintenance mode.
Tinker (REPL)
An interactive ProcessWire PHP REPL for quick testing and debugging.
Security: Set
PW_CLI_DISABLE_TINKER=1in production environments to disable this command.
JSON Output (Machine-Readable)
Every command supports the --json flag for machine-readable output. This makes ProcessWire Console first-class for CI/CD pipelines, AI agent integrations, and automation scripts.
Response format:
Error format:
Examples:
Interactive Mode
Commands that create or modify data support interactive prompts powered by Laravel Prompts:
page:create -i— Select template from a list, enter parent path, fill template fields interactivelyuser:create— Prompts for username, email, password (with confirmation), and role selection
Interactive prompts are automatically disabled when:
- The
--jsonflag is present - The
--forceflag is present - The terminal is non-interactive (piped input)
Extending the Console
Method 1: Module Feature Auto-Discovery
ProcessWire Console features a centralized FeatureDiscoverer that automatically locates and registers CLI assets from the root site/ directory and exclusively from installed/active modules. If a module is inactive or uninstalled, its CLI features are safely ignored.
Place the corresponding files inside the target hierarchy (site/... or site/modules/[ModuleName]/...):
commands/— Drop-in Symfony Console commands (*Command.php)migrations/— Database migrations (*_[name].php)seeders/— Database seeders (*Seeder.php)schedule/— Scheduled cron tasks (*Task.php)queue/— Background queue jobs (*Queue.php)
They are automatically discovered and loaded on every CLI invocation.
Method 2: Composer Package Discovery
Register commands in your package's composer.json:
The console engine reads vendor/composer/installed.json and root composer.json path repositories to discover commands automatically.
Security
Path Traversal Protection
Log commands (log:tail, log:read, log:clear) sanitize the log name argument with basename() to prevent directory traversal attacks.
Tinker Guard
The tinker command executes arbitrary PHP via eval(). To disable it in production:
Confirmation Prompts
All destructive commands (*:delete, *:trash, db:restore, backup:purge, migrate:reset, migrate:fresh) require explicit confirmation. Use --force to bypass for scripting.
Migration Safety
Migration stubs enforce safe-by-default guards in down() — they never cascade-delete user content. If a field is in use, a template has pages, or a role is assigned to users, the rollback will throw a descriptive WireException instead of silently destroying data. See Safe-by-Default Guards for details.
Dry-Run Mode
Preview any mutation with --dry-run:
Architecture
Bootstrap Flow
- Locate Composer autoloader (supports standard and symlinked setups)
- Walk upward to find
wire/core/ProcessWire.php - Boot ProcessWire with database config (graceful fallback if unavailable)
- Register 57 built-in commands (including 8 migration commands)
- Auto-discover custom commands dynamically from:
- Site profile:
site/commands/ - Installed modules:
site/modules/*/commands/
- Site profile:
- Discover commands from Composer packages (
extra.processwire-console.commands) - Run the Symfony Console application
Design Principles
- Null-safe: All ProcessWire API
->get()calls are guarded againstnullreturns - Strict typing:
declare(strict_types=1)in every file - Consistent I/O: All commands use
SymfonyStylefor formatted output - Dual output: Human-readable tables + machine-readable JSON on every command
- Non-destructive defaults: Confirmations on mutations,
--dry-runfor previews
Requirements
| Dependency | Version |
|---|---|
| PHP | ≥ 8.3 |
| ProcessWire | 3.x |
symfony/console |
^7.0 |
laravel/prompts |
^0.3.13 |
License
MIT — see LICENSE for details.
All versions of processwire-console with dependencies
laravel/prompts Version ^0.3
symfony/console Version ^7.0 || ^8.0
dragonmantank/cron-expression Version ^3.6