Robo

Modern Task Runner for PHP

Download robo.phar »

Gitter

Release

Total Downloads

License MIT

What is Robo?

Robo is a task runner you always have been looking for. It allows you to write fully customizable tasks in common OOP PHP style. Robo has comprehensive list of built-in common tasks for development, testing, and deployment.

Use Robo to

  • automate your common tasks
  • start workers
  • run parallel tasks
  • execute commands
  • run tests
  • watch filesystem changes

Install

Via Composer

Add to composer.json of your project

require-dev: {
    "consolidation/robo": "^1.0.0"
}
or install it globally:
composer global require consolidation/robo
Download robo.phar

Using Phar

wget http://robo.li/robo.phar

or download it via HTTPS from GitHub releases

To install globally put robo.phar in /usr/bin (/usr/local/bin in OSX 10.11+).

chmod +x robo.phar && sudo mv robo.phar /usr/bin/robo

Now you can use it just like robo.

Feedback

<?php // all tasks are defined in RoboFile.php
class RoboFile {
/**
 * Each public method is a command in runner
 * parameters are arguments in console
 *
 * use './robo test' to run tests on a project
 */
function test($pathToSelenium = '~/selenium.jar')
{
    // starts PHP server in background
    $this->taskPhpServer(8000)
        ->background()
        ->dir('web')
        ->run();

    // launches Selenium server
    $this->taskExec('java -jar '.$pathToSelenium)
        ->background()
        ->run();

    // runs PHPUnit tests
    $this->taskPHPUnit()
        ->run();
}

/**
 * Cleanup temporary files
 */
function clean()
{
    $this->_cleanDir(['app/cache', 'app/logs']);
    $this->_deleteDir(['web/assets/tmp_uploads']);
}

/**
 * Minify assets
 */
function assets()
{
    // concat CSS files
    $this->taskConcat(['web/css/core.css','web/css/theme.css'])
        ->to('main.css')
        ->run();

    // minify CSS files
    $this->taskMinify('main.css')
        ->to('main.min.css')
        ->run();

    // install Bower dependencies
    $this->taskBowerInstall()
        ->dir('web')
        ->run();
}
// ...Git, Ssh, Docker, and other tasks available
}