Artisan CLI
The Artisan CLI is an integrated command-line interface for the WpMVC framework, engineered to automate repetitive development tasks. Built on the industry-standard symfony/console component and inspired by Laravel’s Artisan, it provides a high-reliability environment for scaffolding core components, managing application state, and streamlining the WordPress plugin development lifecycle.
Technical Integration
Installation
The CLI package is typically included as a core dependency within the WpMVC framework. For custom integrations or standalone utility usage, it can be integrated via Composer:
composer require wpmvc/artisanExecution Environment
Artisan is executed through the artisan binary located in the application’s root directory.
php artisan [command] [options] [arguments]System Orchestration Commands
Application Initialization
app:setup
The primary command for initializing a new WpMVC ecosystem. It orchestrates the renaming of entry files, updates global namespaces, configures text domains, and synchronizes Composer dependencies.
php artisan app:setupScaffolding & Code Generation
Artisan provides a suite of make commands to generate standardized boilerplate code, ensuring architectural consistency across the application.
Component Generators
| Command | Destination | Description |
|---|---|---|
make:controller | app/Http/Controllers | Generates a REST API controller with optional method scaffolding. |
make:model | app/Models | Creates an Eloquent-ready model for database interaction. |
make:middleware | app/Http/Middleware | Scaffolds a request interceptor for pipeline management. |
make:repository | app/Repositories | Generates a data access layer for domain logic isolation. |
make:dto | app/DTOs | Creates a strict-typed Data Transfer Object for payload integrity. |
make:mail | app/Mail | Scaffolds a mailable class and its corresponding view template. |
make:request | app/Http/Requests | Generates a custom form request class for advanced validation logic. |
make:factory | database/factories | creates a database factory for generating model test data. |
make:seeder | database/seeders | Scaffolds a database seeder for table population. |
make:provider | app/Providers | Scaffolds a Service Provider for dependency injection and service registration. |
Technical Reference
make:controller
Instantiates a new controller class. This command minimizes manual boilerplate by establishing correct namespace and class inheritance.
php artisan make:controller UserControllermake:model
Generates a new database model class.
php artisan make:model Postmake:repository
Standardizes data access logic by generating a new repository class. Use this to maintain a clean separation between database queries and business logic.
php artisan make:repository UserRepositorymake:provider
Generates a Service Provider class to manage service discovery and dependency container bindings.
php artisan make:provider PostTypeServiceProvidermake:middleware
Scaffolds a new request middleware to intercept or modify incoming HTTP requests within the application pipeline.
php artisan make:middleware EnsureIsAdminmake:mail
Generates a mailable class for structured email composition, including its associated view template.
php artisan make:mail WelcomeEmailmake:request
Creates a dedicated Form Request class, enabling complex validation rules and authorization logic to be decoupled from controllers.
php artisan make:request StoreUserRequestmake:factory
Instantiates a new database factory class, facilitating the generation of consistent dummy data for testing and development.
php artisan make:factory UserFactorymake:seeder
Generates a database seeder class used to programmatically populate database tables with initial or sample data.
php artisan make:seeder UserSeedermake:dto
Generates a strict-typed Data Transfer Object (DTO) to ensure data integrity and structural consistency when passing data between application layers.
php artisan make:dto UserDTODatabase Management
Artisan provides commands for managing database state, seeding, and migrations within the WpMVC ecosystem.
db:seed
Executes database seeders to populate tables. By default, it runs the main DatabaseSeeder class.
php artisan db:seedUse the --class option to target a specific seeder.