PHPackages                             droid/droid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. droid/droid

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

droid/droid
===========

Droid: a Taskrunner to Build, Test, CI, deploy your app

v1.23.1(9y ago)114273[2 issues](https://github.com/droid-php/droid/issues)1MITPHPPHP &gt;=5.3.0

Since Apr 3Pushed 9y ago3 watchersCompare

[ Source](https://github.com/droid-php/droid)[ Packagist](https://packagist.org/packages/droid/droid)[ Docs](http://www.github.com/droid-php/droid)[ RSS](/packages/droid-droid/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (12)Versions (36)Used By (1)

Droid: Build, Test, CI, deploy
==============================

[](#droid-build-test-ci-deploy)

[![](https://camo.githubusercontent.com/3b8caed97d944b6b3832fd0574416c0fe45a97a65d369c9ec391c2352d18017a/687474703a2f2f322e62702e626c6f6773706f742e636f6d2f5f586450364c7032636571592f54503850333638427a4d492f4141414141414141695a302f67645a4e2d6765614e39342f73313630302f74332e504e47)](https://camo.githubusercontent.com/3b8caed97d944b6b3832fd0574416c0fe45a97a65d369c9ec391c2352d18017a/687474703a2f2f322e62702e626c6f6773706f742e636f6d2f5f586450364c7032636571592f54503850333638427a4d492f4141414141414141695a302f67645a4e2d6765614e39342f73313630302f74332e504e47)

Droid is a task-runner, similar to [Apache Ant](http://ant.apache.org/), [Gulp](http://gulpjs.com/), [Grunt](http://gruntjs.com/), [Phing](https://www.phing.info/), etc.

It helps you to automatically build your project, compile assets, create directory structures, run and validate tests, setup fixtures, and eventually deploy your app.

Tasks are implemented as standard [Symfony Commands](http://symfony.com/doc/current/cookbook/console/console_command.html), allowing you to use standard existing commands to script your builds.

Installation
------------

[](#installation)

Add the following line to your `composer.json`:

```
"require": {
   "droid/droid": "~1.0"
}
```

Then run `composer update` to install your updated required packages.

Configuring droid for your project
----------------------------------

[](#configuring-droid-for-your-project)

Create a `droid.yml` file in the root of your repository. For example:

```
targets:
   default:
      name: "Building it"
      tasks:
         - "composer:install":
            prefer: dist
         - "bower:install": ~
   cs:
      requires:
         - default
      tasks:
         - "phpcs:check": ~

   test:
      requires:
         - build
         - cs
      tasks:
         - "phpunit:test": ~

   deploy:
      requires:
         - build
      loop:
         -
            host: app1.example.com
            port: 22
         -
            host: app2.example.com
            port: 2222

      tasks:
         - "deploy:ssh":
            sshkey: "{{ deploy.sshkey }}"
            basepath: "/code/myapp/"
```

At the top level, you define the "targets". When you run droid, you always pass a target name. It uses target name "default" if none is specified.

For each target, you can define a set of "tasks". Each task has a command name (for example "core:echo") and a list of arguments for that command.

Running droid
-------------

[](#running-droid)

### Running a target

[](#running-a-target)

```
vendor/bin/droid run
```

This will run the "default" target.

Alternatively, you can specify which target to run:

```
vendor/bin/droid run test
```

Listing available commands
--------------------------

[](#listing-available-commands)

```
vendor/bin/droid list
```

This lists the available commands you can use in your `droid.yml` file.

Registering your own custom commands
------------------------------------

[](#registering-your-own-custom-commands)

To register custom commands, you can add the following section to your droid.yml:

```
register:
    - Haigha\Command\LoadCommand: ~
```

When you list the available commands, you'll find that [Haiga's](http://github.com/linkorb/haigha) `fixture:load` command has been added to the available command list. You can now use it as a command in your target tasks.

If you'd like to change the default 'name' for the registered command, simply pass a name parameter:

```
register:
    - Haigha\Command\LoadCommand:
        name: "haigha:load"
```

Creating plugins for Droid
--------------------------

[](#creating-plugins-for-droid)

Droid plugins are composer packages that can automatically register their commands in droid. The consuming application won't need to use the `register` key in their `droid.yml`.

You can easily turn your php package into a Droid plugin by including a class called `DroidPlugin` in the root of your library's PHP namespace. For example, if your project's namespace is 'Acme\\MyApp', you can add a file in the root of that namespace called 'DroidPlugin' like this:

```
