Making a Command

To make your own galaxy CLI command use the galaxy command make:command. Galaxy commands use the Symfony Console Package. Lets make a command named app:test.

php galaxy make:command Test app:test

This will output,

Command created: Test
Configure Command Test: Add your command to config/galaxy.php

You can now find your new command at app/Commands/Test.php. We will take a look at it next, but first add the command to the galaxy.php configuration file.

'commands' => [

Now run php galaxy list and check for:

  app:test         Short description here

Now run the command:

 php galaxy app:test

This will output,


You are now ready to start building your command.

Coding Commands

Here is the Test command class we just created. If you want to make your commands without the galaxy CLI this can serve as a working template.

namespace App\Commands;

use \TypeRocket\Console\Command;

class Test extends Command

    protected $command = [
        'Short description here',
        'Longer help text goes here.',

    protected function config()
        // If you want to accept arguments
        // $this->addArgument('arg', self::REQUIRED, 'Description');

    public function exec()
        // When command executes