Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Robo Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • Task naming convention: Robo automatically converts taskXyz methods to xyz commands (e.g., taskBuild becomes robo build).
  • Composing tasks: Use built-in task helpers ($this->taskExec(), $this->taskWriteFile(), $this->taskCollection()) to chain operations:
    public function taskDeploy(): void
    {
        $this->taskCompileAssets()->run();
        $this->taskMigrate()->run();
    }
    
  • Configuration: Load config from robo.yml (YAML) or robo.dist.yml for defaults. Use $this->getConfig() in tasks to access config.
  • Parallel execution: Use TaskCollection to group and run tasks sequentially or in parallel via $this->collection() or $this->taskParallelExec().
  • Testing: Write unit tests by mocking $this->taskCollection() and asserting side effects (e.g., file writes, output messages).

Gotchas and Tips

  • Method visibility matters: Only public methods prefixed with task* are exposed as commands. Private/protected methods won’t show up in robo list.
  • Return values: Robo tasks should return $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.
  • Config precedence: robo.yml (project-level) overrides robo.dist.yml (distribution-level), but CLI options (e.g., --config=custom.yml) override both.
  • Dependency injection: Robo respects constructor injection via container (if container-interop or php-di is present), but simplest is to use getConfig() for config-based dependencies.
  • Output formatting: Use $this->output() for styled messages (<info>Success</info>) — say() is plain. For detailed debugging, $this->debug('...') emits verbose output only with --verbose flag.
  • Extend safely: Avoid subclassing Robo’s base classes (Task, Commands) directly in RoboFile; use composition ($this->taskXyz()) instead for maintainability.
  • Async tasks: Use $this->taskParallelExec() — but be aware it doesn’t capture output by default; use ->printOutput(true) to stream.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport