Deeploy /

Filename Size Date modified Message
133 B
2.6 KB
490 B
3.1 KB


1. What is Deeploy?

Deeploy is a simple php library that allows you to create routines in php that can be easily executed over SSH on one or more servers defined in a JSON formatted file or string. Please, only use this to see how it works, don't use it in production! There's Fabric and Capistrano to do that for you.

2. How to use it?

The best way to use the Deeploy library is to use composer to download and autoload it into your project.


    "repositories": [
            "type": "vcs",
            "url": ""
    "require": {
        "turanct/deeploy": "master"

After you've put the repository in your project's composer.json file, you can let composer download the dependencies. Assuming that you have the composer.phar file in your project root:

php composer.phar install

Then create a class which contains some subroutines (as methods). The class should extend the Deeploy\Deeploy class. From within your routines you can use the $this->server variable to do some interesting things on the server the routine will run on.


// Require the composer autoloader

 * Create a class containing some routines
class Routines extends Deeploy\Deeploy {

    public function routine_one() {
        echo $this->server->exec('pwd');
        echo $this->server->exec('cd /tmp && pwd');

    public function routine_two() {
        echo $this->server->exec('uname -a');


When that's done you can define some config vars in json format and run your routines on the defined servers.


// Create our config variable (json structure)
$config = '{
    "test1": {
        "host": "",
        "user": "Deeploy",
        "keyfile": "/Users/Deeploy/.ssh/id_rsa",
        "keypass": "{id_rsa passphrase}"

// Require our routines class

// Create an instance of our Routines class
$deeploy = new Routines($config);

// We'll run the routines on this list of servers (array)

// We'll run these routines on those servers (array)
$deeploy->routines(array('routine_one', 'routine_two'));

// Go!

This example will log in to the server test1, and run routines routine_one and routine_two, defined in our Routines class.

3. Examples

You can find example code in the examples directory.