php-yii
Yii framework console command runner
TLDR
SYNOPSIS
php yii [command] [--option=value...]
DESCRIPTION
yii is the console entry point for Yii 2.0 PHP framework applications. It provides access to built-in commands for database migrations, code generation, caching, asset management, and application serving.
Console commands use the route format controller/action (e.g., migrate/create). Options are passed as --option=value. Custom console commands can be created by extending yii\console\Controller.
The gii commands provide code generation capabilities for models, controllers, CRUD interfaces, forms, modules, and extensions. The migrate commands manage database schema changes through versioned migration files.
PARAMETERS
--tableName name
Database table name (gii/model).--modelClass class
Model class name (gii/model, gii/crud).--interactive 0|1
Run in non-interactive mode. Default: 1.--color 0|1
Enable/disable ANSI color output.
SUBCOMMANDS
help [command]
Show available commands or help for a specific command.migrate
Run pending database migrations.migrate/create name
Create a new migration file.migrate/down [count]
Rollback migrations. Default: 1.migrate/redo [count]
Redo migrations (down then up).gii/model
Generate model class from database table.gii/crud
Generate CRUD controller and views.gii/controller
Generate controller class.cache/flush-all
Clear all application caches.cache/flush component
Flush a specific cache component.asset/compress configFile bundleFile
Combine and compress JavaScript and CSS files.serve
Run PHP built-in web server.
CAVEATS
Must be run from the project root directory where the yii bootstrap file exists. Requires a properly configured Yii 2.0 application. Some commands like gii require the yii2-gii extension. Database commands require configured database connection.
HISTORY
The Yii console was introduced with Yii 2.0, released in 2014 by Qiang Xue. The console runner replaced the yiic tool from Yii 1.x with a more flexible command architecture.
