#}
CLI Components
Powerful command-line tools for project management, code generation, and maintenance
CLI Components
Overview
GEMVC provides a powerful command-line interface for project scaffolding, code generation, database management, and maintenance tasks.
Project Init Scaffold new projects
Code Generation Create CRUD, models, controllers
Database Migrations and management
Maintenance Cache, deployment tools
Project Initialization
Project Init Commands
# Initialize a new GEMVC project
php vendor/bin/gemvc init
# Initialize with specific server type
php vendor/bin/gemvc init --swoole
php vendor/bin/gemvc init --apache
php vendor/bin/gemvc init --nginx
# Non-interactive mode
php vendor/bin/gemvc init --server=swoole --non-interactive
Code Generation
Generate complete CRUD operations or individual components:
Code Generation Commands
# Create complete CRUD (service, controller, model, table)
php vendor/bin/gemvc create:crud UserService
# Create individual components
php vendor/bin/gemvc create:service UserService
php vendor/bin/gemvc create:controller UserController
php vendor/bin/gemvc create:model User
php vendor/bin/gemvc create:table users
# With options
php vendor/bin/gemvc create:service UserService -cmt # Include controller, model, table
Tip: Use create:crud for the fastest way to build a complete API - it generates all required files in one command!
Database Management
Database Commands
# Initialize database
php vendor/bin/gemvc db:init
# Run migrations
php vendor/bin/gemvc db:migrate UserTable
php vendor/bin/gemvc db:migrate UserTable --force
php vendor/bin/gemvc db:migrate UserTable --sync-schema
# Database utilities
php vendor/bin/gemvc db:list # List all tables
php vendor/bin/gemvc db:describe users # Describe table structure
php vendor/bin/gemvc db:drop users # Drop a table
php vendor/bin/gemvc db:unique users email # Add unique constraint
Command Reference
| Command | Description |
|---|---|
| init | Initialize new GEMVC project |
| create:crud | Generate complete CRUD operations |
| create:service | Create API service class |
| create:controller | Create controller class |
| create:model | Create model class |
| create:table | Create table class |
| db:init | Initialize database connection |
| db:migrate | Run database migrations |
| db:list | List all database tables |
| db:describe | Show table structure |
info: Run php vendor/bin/gemvc --help to see all available commands and options.