PHPackages                             underpin/wp-cli-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. underpin/wp-cli-loader

ActiveLibrary[CLI &amp; Console](/categories/cli)

underpin/wp-cli-loader
======================

WP CLI Loader for Underpin

1.1.0(4y ago)019GPL-2.0-or-laterPHP

Since May 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Underpin-WP/wp-cli-loader)[ Packagist](https://packagist.org/packages/underpin/wp-cli-loader)[ RSS](/packages/underpin-wp-cli-loader/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Underpin WP CLI Loader
======================

[](#underpin-wp-cli-loader)

Loader That assists with adding WP CLI commands to a WordPress website.

Installation
------------

[](#installation)

### Using Composer

[](#using-composer)

`composer require underpin/cli-loader`

### Manually

[](#manually)

This plugin uses a built-in autoloader, so as long as it is required *before*Underpin, it should work as-expected.

`require_once(__DIR__ . '/underpin-cli/cli.php');`

Setup
-----

[](#setup)

1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)
2. Register new WP CLI commands as-needed.

Basic Example
-------------

[](#basic-example)

A very basic example could look something like this. This will create a single command `wp test`.

```
\Underpin\underpin()->cli()->add( 'test', [
	'command'             => 'test',                           // Command name.
	'name'                => 'Test Command',                   // Human-readable name. Used by Underpin logging tools.
	'description'         => 'Runs a test command in the CLI', // Human-readable description. Used by Underpin logging tools.
	'action_callback'     => function ( $args ) {              // The command to run when this command is invoked in the CLI
		\WP_CLI::success( "The script has run, $args[0]!" );
	},
	'command_description' => [                                 // Optional. The description of the command. See WP CLI cookbook.
		'shortdesc' => 'Prints a test message.',
		'synopsis'  => [
			[
				'type'        => 'positional',
				'name'        => 'name',
				'description' => 'The name of the person to greet.',
				'optional'    => false,
				'repeating'   => false,
			],
		],
		'longdesc'  => '## EXAMPLES' . "\n\n" . 'Success: The script has run, Alex!',
	],
] );
```

Running the above command would look like:

```
$ wp test
Success: The script has run, !

```

```
$ wp test Alex
Success: The script has run, Alex!

```

Running help would output the help as such:

```
$ wp test --help
NAME

  wp test

DESCRIPTION

  Prints a test message.

SYNOPSIS

  wp test

OPTIONS

    The name of the person to greet.

EXAMPLES

  Success: The script has run, Alex!

GLOBAL PARAMETERS

:

```

Sub Commands
------------

[](#sub-commands)

If you want to make several commands inside a namespace, you must extend `Command` and reference the extended class directly, like so:

Check out [WP\_CLI's Commands Cookbook](https://make.wordpress.org/cli/handbook/guides/commands-cookbook/) for more information.

```
class Say_Hello extends Underpin_Commands\Abstracts\Command{

	protected $command = 'say';
	/**
	 * Prints a greeting.
	 *
	 * ## OPTIONS
	 *
	 *
	 * : The name of the person to greet.
	 *
	 * [--type=]
	 * : Whether or not to greet the person with success or error.
	 * ---
	 * default: success
	 * options:
	 *   - success
	 *   - error
	 * ---
	 *
	 * ## EXAMPLES
	 *
	 *     wp example hello Newman
	 *
	 * @when after_wp_load
	 */
	function hello( $args, $assoc_args ) {
		list( $name ) = $args;

		// Print the message with type
		$type = $assoc_args['type'];
		\WP_CLI::$type( "Hello, $name!" );
	}

}

\Underpin\underpin()->cli()->add('say','Say_Hello');
```

Running the above command would look like:

```
$ wp say hello Alex --type=error
Error: Hello, Alex!

```

```
$ wp say hello Kate
Success: Hello, Kate!

```

```
$ wp say hello
usage: wp say hello  [--type=]

```

Running help would output help as such:

```
$ wp say hello --help
NAME

  wp say hello

DESCRIPTION

  Prints a greeting.

SYNOPSIS

  wp say hello  [--type=]

OPTIONS

    The name of the person to greet.

  [--type=]
    Whether or not to greet the person with success or error.
    ---
    default: success
    options:
      - success
      - error
    ---

EXAMPLES

    wp example hello Newman

GLOBAL PARAMETERS

  --path=
      Path to the WordPress files.

  --url=
      Pretend request came from given URL. In multisite, this argument is how the target site is specified.

  --ssh=[:][@][:][]
      Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "vagrant").

  --http=
      Perform operation against a remote WordPress installation over HTTP.

  --user=
      Set the WordPress user.

  --skip-plugins[=]
      Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded.
:

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~196 days

Total

2

Last Release

1635d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e6206223bd6f2a57b8ac80605b1b5c3521faaec18ad3f20f25fb728a9a13784?d=identicon)[tstandiford](/maintainers/tstandiford)

---

Top Contributors

[![alexstandiford](https://avatars.githubusercontent.com/u/8210827?v=4)](https://github.com/alexstandiford "alexstandiford (7 commits)")

### Embed Badge

![Health badge](/badges/underpin-wp-cli-loader/health.svg)

```
[![Health](https://phpackages.com/badges/underpin-wp-cli-loader/health.svg)](https://phpackages.com/packages/underpin-wp-cli-loader)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
