PHP code example of kynetcode / wpzylos-wp-cli

1. Go to this page and download the library: Download kynetcode/wpzylos-wp-cli library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kynetcode / wpzylos-wp-cli example snippets


class ImportCommand
{
    public function run(array $args, array $assocArgs): void
    {
        $file = $assocArgs['file'] ?? null;

        if (!$file) {
            WP_CLI::error('File path is 

// In your service provider
if (defined('WP_CLI') && WP_CLI) {
    $import = new ImportCommand();
    WP_CLI::add_command("{$slug} data:import", [$import, 'run']);
}