Skip to content

Kirby 3.8.2

Commands

This feature of the Kirby CLI is currently in development. You need the latest develop branch version of getkirby/cli.

You can register new commands for the Kirby CLI in your plugins with the commands extension.

/site/plugins/your-plugin/index.php
Kirby::plugin('your/plugin', [
  'commands' => [
    'your-plugin:test' => [
      'description' => 'Nice command',
      'args' => [],
      'command' => function ($cli) {
        $cli->success('My first plugin command');
      }
    ]
  ]
]);

Once your plugin is installed, the command can be executed with …

kirby your-plugin:test

Namespaces

We recommend to use such a namespace as in the example above.

your-plugin:test
your-plugin:another-task

Otherwise you might run into collisions with other commands from plugins. Core, local and global commands in the CLI always get registered first. If there's a command with the same name, your plugin command will be ignored.

CLI Documentation

Please check out the CLI docs to find out how to create your commands, work with arguments and more.

https://github.com/getkirby/cli