定制 wpdiggerstudio/wpzylos-wp-cli 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wpdiggerstudio/wpzylos-wp-cli

最新稳定版本:v1.1.0

Composer 安装命令:

composer require wpdiggerstudio/wpzylos-wp-cli

包简介

WP-CLI bridge for WPZylos framework (only loaded when WP_CLI)

README 文档

README

PHP Version License GitHub

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
  • Cache Commands — Clear plugin caches
  • Custom Commands — Register plugin-specific WP-CLI commands
  • WP_CLI Only — Loaded only in CLI context
  • Scheduler Commands — Manage scheduled tasks

📋 Requirements

Requirement Version
PHP ^8.0
WordPress 6.0+
WP-CLI 2.0+

🚀 Installation

composer require wpdiggerstudio/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

# Clear cache
wp myplugin cache:clear

🛠️ 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 and re-run all migrations
wp myplugin migrate:refresh

# Show migration status
wp myplugin migrate:status

Cache Commands

# Clear all plugin caches
wp myplugin cache:clear

# Clear specific cache
wp myplugin cache:clear --key=settings

Scheduler Commands

# List scheduled tasks
wp myplugin schedule:list

# Run a specific scheduled task
wp myplugin schedule:run task_name

🏗️ Creating Custom Commands

use WPZylos\Framework\WpCli\Command;

class ImportCommand extends Command
{
    protected string $signature = 'data:import';
    protected string $description = 'Import data from a file';

    public function handle(array $args, array $assoc_args): void
    {
        $file = $assoc_args['file'] ?? null;

        if (!$file) {
            $this->error('File path is required');
            return;
        }

        $this->info("Importing from {$file}...");

        // Import logic here

        $this->success('Import complete!');
    }
}

Registering Commands

// In your plugin's boot method
$app->registerCommand(ImportCommand::class);

📦 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

If you find this package helpful, consider buying me a coffee! Your support helps maintain and improve the WPZylos ecosystem.

Donate with PayPal

📄 License

MIT License. See LICENSE for details.

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Made with ❤️ by WPDiggerStudio

统计信息

  • 总下载量: 239
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固