kynetcode/wpzylos-wp-cli
Composer 安装命令:
composer require kynetcode/wpzylos-wp-cli
包简介
WP-CLI bridge for WPZylos framework (only loaded when WP_CLI)
README 文档
README
WP-CLI bridge for WPZylos framework (only loaded when WP_CLI).
📖 Full Documentation | 🐛 Report Issues
✨ Features
- Vendor Publish — Laravel-style config publishing
- Migration Commands — Run/rollback database migrations
- WP_CLI Only — Loaded only in CLI context
📋 Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.0 |
| WordPress | 6.0+ |
| WP-CLI | 2.0+ |
🚀 Installation
composer require KYNetCode/wpzylos-wp-cli
📖 Quick Start
# Publish package configs (like Laravel) wp myplugin vendor:publish --provider=RequirementsServiceProvider # Run migrations wp myplugin migrate # Rollback last migration wp myplugin migrate:rollback
🛠️ Available Commands
Vendor Publish Commands (Laravel-style)
# Publish config from a specific provider wp myplugin vendor:publish --provider=RequirementsServiceProvider # Publish all package configs wp myplugin vendor:publish --all # Force overwrite existing files wp myplugin vendor:publish --provider=RequirementsServiceProvider --force # Publish by tag (e.g., config, views) wp myplugin vendor:publish --tag=config # List all publishable assets wp myplugin vendor:publish:list
Migration Commands
# Run all pending migrations wp myplugin migrate # Rollback last batch wp myplugin migrate:rollback # Rollback specific number of steps wp myplugin migrate:rollback --steps=3 # Show migration status wp myplugin migrate:status
🏗️ Creating Custom Commands
class ImportCommand { public function run(array $args, array $assocArgs): void { $file = $assocArgs['file'] ?? null; if (!$file) { WP_CLI::error('File path is required'); return; } WP_CLI::log("Importing from {$file}..."); // Import logic here WP_CLI::success('Import complete!'); } }
Registering Commands
// In your service provider if (defined('WP_CLI') && WP_CLI) { $import = new ImportCommand(); WP_CLI::add_command("{$slug} data:import", [$import, 'run']); }
📦 Related Packages
| Package | Description |
|---|---|
| wpzylos-core | Application foundation |
| wpzylos-cli-core | Stub compilation utilities |
| wpzylos-cli-devtool | Development CLI commands |
| wpzylos-migrations | Database migrations |
📖 Documentation
For comprehensive documentation, tutorials, and API reference, visit wpzylos.com.
☕ Support the Project
📄 License
MIT License. See LICENSE for details.
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Made with ❤️ by KYNetCode
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-06-16