Commits

turanct  committed ce427a9

Readme update

  • Participants
  • Parent commits eef69a0

Comments (0)

Files changed (1)

 
 1. What is Deeploy?
 -------------------------------------
-Deeply is a simple php library to have easy access to SSH from within php. It allows you to create routines in php that can be easily executed on one or more servers defined in a JSON formatted file or string.
+Deeply 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.
 
 
 2. How to use it?
 		}
 	}
 
+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.
 
 
 		public function routine_one() {
 			echo $this->server->exec('pwd');
-			echo $this->server->exec('ls -al');
-			echo $this->server->exec('cd /tmp && ls -al');
+			echo $this->server->exec('cd /tmp && pwd');
 		}
 
 		public function routine_two() {
 	}
 
 
+When that's done you can define some config vars in json format and run your routines on the defined servers.
+
+`Script.php`
+
+	// Create our config variable (json structure)
+	$config = '{
+		"test1": {
+			"host": "test1.dev",
+			"user": "Deeploy",
+			"keyfile": "/Users/Deeploy/.ssh/id_rsa",
+			"keypass": "{id_rsa passphrase}"
+		}
+	}';
+
+	// Require our routines class
+	require_once('Routines.php');
+
+	// Create an instance of our Routines class
+	$deeploy = new Routines($config);
+
+	// We'll run the routines on this list of servers (array)
+	$deeploy->servers(array('test1'));
+
+	// We'll run these routines on those servers (array)
+	$deeploy->routines(array('routine_one', 'routine_two'));
+
+	// Go!
+	$deeploy->run();
+
+This example will log in to the server `test1`, and run routines `routine_one` and `routine_two`, defined in our `Routines` class.
+
 
 3. Examples
 -------------------------------------