consolidation/robo
Robo is a modern PHP task runner for automating common development workflows. Define tasks in a RoboFile with a clean OO API to run tests, build assets, deploy, and more. Extensible via plugins, with useful built-in tasks and CLI tooling.
Robo is a modern, PSR-4 compliant task runner for PHP that lets you define and execute CLI commands using PHP classes. Start by installing it via Composer:
composer require --dev consolidation/robo
Create a robo.php (or RoboFile.php) in your project root. This file is auto-discovered and serves as the entry point for your tasks. Define tasks as public methods in a class extending Robo\Tasks:
<?php
use Robo\Tasks;
class RoboFile extends Tasks
{
public function taskHelloWorld(): void
{
$this->say('Hello, Robo!');
}
}
Run the task with:
vendor/bin/robo hello-world
The first thing to read is the official Robo documentation — especially the section on Tasks and Input/Output.
taskXyz methods to xyz commands (e.g., taskBuild becomes robo build).$this->taskExec(), $this->taskWriteFile(), $this->taskCollection()) to chain operations:
public function taskDeploy(): void
{
$this->taskCompileAssets()->run();
$this->taskMigrate()->run();
}
robo.yml (YAML) or robo.dist.yml for defaults. Use $this->getConfig() in tasks to access config.TaskCollection to group and run tasks sequentially or in parallel via $this->collection() or $this->taskParallelExec().$this->taskCollection() and asserting side effects (e.g., file writes, output messages).public methods prefixed with task* are exposed as commands. Private/protected methods won’t show up in robo list.$this (for chaining) or Result objects — but the execution of a task returns a ResultInterface. run() is often implied; don’t forget it if calling tasks manually.robo.yml (project-level) overrides robo.dist.yml (distribution-level), but CLI options (e.g., --config=custom.yml) override both.container-interop or php-di is present), but simplest is to use getConfig() for config-based dependencies.$this->output() for styled messages (<info>Success</info>) — say() is plain. For detailed debugging, $this->debug('...') emits verbose output only with --verbose flag.Task, Commands) directly in RoboFile; use composition ($this->taskXyz()) instead for maintainability.$this->taskParallelExec() — but be aware it doesn’t capture output by default; use ->printOutput(true) to stream.How can I help you explore Laravel packages today?