Skip to content
Modern task runner for PHP
PHP Other
  1. PHP 99.7%
  2. Other 0.3%
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Adding documentation as option to pull_request_template.md (#862) Oct 5, 2019
.scenarios.lock Back off minimum versions of Symfony dependencies just a touch to ali… Feb 19, 2020
build/logs Add build/logs directory. Apr 25, 2016
data/Task/Development Add GenerateMarkdownDocCest test. Sep 3, 2016
docs Robo release 2.0.4 May 22, 2020
examples Revert "Improved param injection (#822)" (#912) Oct 27, 2019
src Prepare for 2.0.7-dev May 22, 2020
tests Docker builds with Buildkit (#942) May 22, 2020
.editorconfig Provide editorconfig file Mar 17, 2016
.gitattributes Prepare for Ignore all of scenarios directory in exports. (#680) Feb 28, 2018
.gitignore Recocile with 1.x (#893) Sep 12, 2019
.scrutinizer.yml Exclude RoboFile.php from Scrutinizer. (#401) Aug 6, 2016
.travis.yml Add PHP 7.4 testing and dependency updates. (#924) Feb 13, 2020
CHANGELOG.md Re-release as 2.0.5 (bad 2.0.4 released) May 22, 2020
CONTRIBUTING.md Add PHP 7.4 testing and dependency updates. (#924) Feb 13, 2020
LICENSE Add PHP 7.4 testing and dependency updates. (#924) Feb 13, 2020
README.md Remove older branch warning Nov 14, 2019
RoboFile.php Minor changes to deprecated "robo test" command. (Use "composer test"… May 22, 2020
appveyor.yml Add PHP 7.4 testing and dependency updates. (#924) Feb 13, 2020
codeception.yml Add PHP 7.4 testing and dependency updates. (#924) Feb 13, 2020
composer.json Back off minimum versions of Symfony dependencies just a touch to ali… Feb 19, 2020
composer.lock Back off minimum versions of Symfony dependencies just a touch to ali… Feb 19, 2020
dependencies.yml Move g1a/composer-test-scenarios from require-dev to require. Jul 19, 2018
phpunit.xml.dist Add PHP 7.4 testing and dependency updates. (#924) Feb 13, 2020
robo Recocile with 1.x (#893) Sep 12, 2019
robo.yml Add EnvConfig to Robo: set configuration values via environment varia… ( May 26, 2018

README.md

RoboTask

Modern and simple PHP task runner inspired by Gulp and Rake aimed to automate common tasks:

Gitter Latest Stable Version Latest Unstable Version Total Downloads

Build Status Windows CI Scrutinizer Code Quality License

  • writing cross-platform scripts
  • processing assets (less, sass, minification)
  • running tests
  • executing daemons (and workers)
  • watching filesystem changes
  • deployment with sftp/ssh/docker

Branches

Branch Symfony Versions PHP Versions
master 4 only PHP 7 only
1.x 2, 3 or 4 PHP 5 supported

Robo versions 2.x and 1.x are largely compatible; however, Robo 2.x supports fewer versions of PHP and Symfony. This is to make ongoing maintenance easier; Robo 1.x will be supported less and less over time. Projects should update to Robo ^2 if possible.

Installing

Phar

Download robo.phar >

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

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

OSX 10.11+

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

Now you can use it just like robo.

Composer

  • Run composer require consolidation/robo:~1
  • Use vendor/bin/robo to execute Robo tasks.

Usage

All tasks are defined as public methods in RoboFile.php. It can be created by running robo init. All protected methods in traits that start with task prefix are tasks and can be configured and executed in your tasks.

Examples

The best way to learn Robo by example is to take a look into its own RoboFile or RoboFile of Codeception project. There are also some basic example commands in examples/RoboFile.php.

Here are some snippets from them:


Run acceptance test with local server and selenium server started.

<?php
class RoboFile extends \Robo\Tasks
{

    function testAcceptance($seleniumPath = '~/selenium-server-standalone-2.39.0.jar')
    {
       // launches PHP server on port 8000 for web dir
       // server will be executed in background and stopped in the end
       $this->taskServer(8000)
            ->background()
            ->dir('web')
            ->run();

       // running Selenium server in background
       $this->taskExec('java -jar ' . $seleniumPath)
            ->background()
            ->run();

       // loading Symfony Command and running with passed argument
       $this->taskSymfonyCommand(new \Codeception\Command\Run('run'))
            ->arg('suite','acceptance')
            ->run();
    }
}

If you execute robo you will see this task added to list of available task with name: test:acceptance. To execute it you should run robo test:acceptance. You may change path to selenium server by passing new path as a argument:

robo test:acceptance "C:\Downloads\selenium.jar"

Using watch task so you can use it for running tests or building assets.

<?php
class RoboFile extends \Robo\Tasks {

    function watchComposer()
    {
        // when composer.json changes `composer update` will be executed
        $this->taskWatch()->monitor('composer.json', function() {
            $this->taskComposerUpdate()->run();
        })->run();
    }
}

Cleaning logs and cache

<?php
class RoboFile extends \Robo\Tasks
{
    public function clean()
    {
        $this->taskCleanDir([
            'app/cache',
            'app/logs'
        ])->run();

        $this->taskDeleteDir([
            'web/assets/tmp_uploads',
        ])->run();
    }
}

This task cleans app/cache and app/logs dirs (ignoring .gitignore and .gitkeep files) Can be executed by running:

robo clean

Creating Phar archive

function buildPhar()
{
    $files = Finder::create()->ignoreVCS(true)->files()->name('*.php')->in(__DIR__);
    $packer = $this->taskPackPhar('robo.phar');
    foreach ($files as $file) {
        $packer->addFile($file->getRelativePathname(), $file->getRealPath());
    }
    $packer->addFile('robo','robo')
        ->executable('robo')
        ->run();
}

We need more tasks!

Create your own tasks and send them as Pull Requests or create packages with "type": "robo-tasks" in composer.json on Packagist.

Credits

Follow @robo_php for updates.

Brought to you by Consolidation Team and our awesome contributors.

License

MIT

You can’t perform that action at this time.