Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHP library for executing commands in parallel on multiple remote machines, via SSH
branch: master

This branch is 28 commits behind thephpleague:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Build Status Dependencies Status Coverage Status Latest Stable Version Total Downloads

Inspired by Ruby's Capistrano, Grunt is PHP library for executing commands in parallel on multiple remote machines, via SSH. Specifically, this library was written to simplify and automate deployment of PHP applications to distributed environments.


Via Composer

    "require": {
        "league/grunt": "1.0.*"


  • PHP >= 5.3.3
  • libssh2


As opinionated as Ruby's Capistrano, Grunt has very firm ideas about how things ought to be done, and tries to force those ideas on you. Some of the assumptions behind these opinions are:

  • You are using SSH to access the remote servers.
  • You either have the same password to all target machines, or you have public keys in place to allow passwordless access to them.

Do not expect these assumptions to change.


In general, you'll use Grunt as follows:

  • Create a recipe file (Gruntfile).
  • Use the grunt script to execute your recipe.

From the root folder of your composer-based project, use the grunt script as follows:

vendor/bin/grunt --some_task

By default, the script will look for a file called Gruntfile, which contain hosts information, credential and your tasks. Here the structure of Gruntfile :


return array(

    'hosts' => array(
        'staging' => ''
        'repro' => ''
        'production' => ''

    'auth' => array(
        'username' => 'grunt',
        'password' => 'hearmyroar',
        'pubkeyfile' => NULL,
        'privkeyfile' => NULL,
        'passphrase' => NULL,

    'tasks' => array(
        'read_home_dir' => function($g) {
        'print_php_info' => function($g) {
            $g->run('php -i');

The tasks collection indicates which tasks that available to execute. Based by above recipe, you could run :

vendor/bin/grunt --read_home_dir

Above command will execute ls on all remote machines defined in hosts parameter. You could tell Grunt to run the task on specific host(s) by appending the host nickname right after the task :

vendor/bin/grunt --read_home_dir staging
vendor/bin/grunt --print_php_info staging,production

Grunt also will automatically create some abbreviation for your task. You can do "grunt" to see all the available tasks.


See the changelog file


Please see CONTRIBUTING for details.


Bugs and feature request are tracked on GitHub


Grunt is released under the MIT License. See the bundled LICENSE file for details.

Something went wrong with that request. Please try again.