diff --git a/.gitignore b/.gitignore
index 1423dc8..e53b77f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
-lib/*
 tests/phpunit.xml
+
+# Ignore Composer's generated lock file.
+composer.lock
diff --git a/commands/runserver/runserver.drush.inc b/commands/runserver/runserver.drush.inc
index 711412f..c81ba0c 100644
--- a/commands/runserver/runserver.drush.inc
+++ b/commands/runserver/runserver.drush.inc
@@ -10,21 +10,6 @@
  */
 
 /**
- * Supported version of httpserver. This is displayed in the manual install help.
- */
-define('DRUSH_HTTPSERVER_VERSION', '41dd2b7160b8cbd25d7b5383e3ffc6d8a9a59478');
-
-/**
- * Directory name for httpserver. This is displayed in the manual install help.
- */
-define('DRUSH_HTTPSERVER_DIR_BASE', 'youngj-httpserver-');
-
-/**
- * Base URL for automatic download of supported version of httpserver.
- */
-define('DRUSH_HTTPSERVER_BASE_URL', 'https://github.com/youngj/httpserver/tarball/');
-
-/**
  * Implementation of hook_drush_help().
  */
 function runserver_drush_help($section) {
@@ -106,22 +91,6 @@ function drush_core_runserver_validate() {
     return drush_set_error('RUNSERVER_PHP_CGI', dt('The runserver command with the "builtin" server requires php 5.4 (or higher), which could not be found.'));
   }
 
-  // Update with detected configuration.
-  $server = drush_get_option('server', FALSE);
-  if ($server == 'cgi') {
-    // Fetch httpserver cgi based server to our /lib directory, if needed.
-    $lib = drush_get_option('lib', DRUSH_BASE_PATH . '/lib');
-    $httpserverfile = $lib . '/' . DRUSH_HTTPSERVER_DIR_BASE . substr(DRUSH_HTTPSERVER_VERSION, 0, 7) . '/httpserver.php';
-    if (!drush_file_not_empty($httpserverfile)) {
-      // Download and extract httpserver, and confirm success.
-      drush_lib_fetch(DRUSH_HTTPSERVER_BASE_URL . DRUSH_HTTPSERVER_VERSION);
-      if (!drush_file_not_empty($httpserverfile)) {
-        // Something went wrong - the library is still not present.
-        return drush_set_error('RUNSERVER_HTTPSERVER_LIB_NOT_FOUND', dt("The runserver command needs a copy of the httpserver library in order to function, and the attempt to download this file automatically failed. To continue you will need to download the package from !url, extract it into the !lib directory, such that httpserver.php exists at !httpserverfile.", array('!version' => DRUSH_HTTPSERVER_VERSION, '!url' => DRUSH_HTTPSERVER_BASE_URL . DRUSH_HTTPSERVER_VERSION, '!httpserverfile' => $httpserverfile, '!lib' => $lib)));
-      }
-    }
-  }
-
   // Check we have a valid server.
   if (!in_array($server, array('cgi', 'builtin'))) {
     return drush_set_error('RUNSERVER_INVALID', dt('Invalid server specified.'));
@@ -223,10 +192,7 @@ function drush_core_runserver($uri = NULL) {
     drush_shell_exec_interactive($php . ' -S ' . $addr . ':' . $uri['port'] . ' --define auto_prepend_file="' . DRUSH_BASE_PATH . '/commands/runserver/runserver-prepend.php"');
   }
   else {
-    // Include the library and our class that extends it.
-    $lib = drush_get_option('lib', DRUSH_BASE_PATH . '/lib');
-    $httpserverfile = $lib . '/' . DRUSH_HTTPSERVER_DIR_BASE . substr(DRUSH_HTTPSERVER_VERSION, 0, 7) . '/httpserver.php';
-    require_once $httpserverfile;
+    // Include the Drush class that uses the autoloaded HTTPServer.
     require_once 'runserver-drupal.inc';
     // Create a new httpserver instance and start it running.
     $server = new DrupalServer(array(
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..3517646
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,47 @@
+{
+  "name": "drush",
+  "description": "",
+  "keywords": [],
+  "homepage": "http://drupal.org/project/drush",
+  "license": "GPLv3",
+  "authors": [
+    { "name": "Moshe Weitzman", "email": "weitzman@tejasa.com" },
+    { "name": "Owen Barton", "email": "drupal@owenbarton.com" },
+    { "name": "Mark Sonnabaum", "email": "marksonnabaum@gmail.com" },
+    { "name": "Antoine Beaupré", "email": "anarcat@koumbit.org" },
+    { "name": "Greg Anderson", "email": "greg.1.anderson@greenknowe.org" },
+    { "name": "Jonathan Araña Cruz", "email": "jonhattan@faita.net" },
+    { "name": "Jonathan Hedstrom", "email": "jhedstrom@gmail.com" }
+  ],
+  "repositories": [
+    {
+      "type": "pear",
+      "url": "http://pear.php.net"
+    },
+    {
+      "type": "package",
+      "package": {
+        "name": "youngj/httpserver",
+        "version": "1.0.0",
+        "source": {
+          "url": "https://github.com/youngj/httpserver",
+          "type": "git",
+          "reference": "41dd2b7160b8cbd25d7b5383e3ffc6d8a9a59478"
+        },
+        "autoload": {
+          "classmap": { "HTTPServer": "" }
+        }
+      }
+    }
+  ],
+  "autoload": {
+    "psr-0": { "Drush": "lib/" },
+    "classmap": [ "vendor/pear-pear/Console_Table/" ]
+  },
+  "require": {
+    "php": ">=5.3.2",
+    "symfony/yaml": ">=2.0.12",
+    "pear-pear/Console_Table": "*",
+    "youngj/httpserver": "1.0.0"
+  }
+}
diff --git a/includes/.gitignore b/includes/.gitignore
deleted file mode 100644
index ed285c0..0000000
--- a/includes/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-table.inc
\ No newline at end of file
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index c13db27..de0386c 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -399,10 +399,6 @@ function _drush_bootstrap_drush_validate() {
     return FALSE;
   }
 
-  if (drush_environment_table_lib() === FALSE) {
-    return FALSE;
-  }
-
   return TRUE;
 }
 
@@ -977,6 +973,10 @@ function drush_bootstrap_value($context, $value = null) {
 function drush_bootstrap_prepare() {
   define('DRUSH_BASE_PATH', dirname(dirname(__FILE__)));
 
+  // Make sure the Drush dependencies are available via Composer.
+  require_once DRUSH_BASE_PATH . '/includes/composer.inc';
+  drush_bootstrap_composer();
+
   require_once DRUSH_BASE_PATH . '/includes/environment.inc';
   require_once DRUSH_BASE_PATH . '/includes/command.inc';
   require_once DRUSH_BASE_PATH . '/includes/drush.inc';
diff --git a/includes/composer.inc b/includes/composer.inc
new file mode 100644
index 0000000..5d91a0b
--- /dev/null
+++ b/includes/composer.inc
@@ -0,0 +1,106 @@
+<?php
+
+/**
+ * @file
+ * Provides Drush bootstrap integration with Composer.
+ */
+
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Output\ConsoleOutput;
+use Symfony\Component\Console\Helper\HelperSet;
+use Composer\IO\ConsoleIO;
+
+/**
+ * Make sure the Drush dependencies are available and up to date.
+ *
+ * @return Composer\Autoload\ClassLoader
+ *   The class loader object that was used to autoload all of the Drush
+ *   dependencies.
+ *
+ * @see drush_bootstrap_composer_update()
+ */
+function drush_bootstrap_composer() {
+  static $composer = NULL;
+
+  // We only have to load Drush's version of Composer once.
+  if (!isset($composer)) {
+    // Compare the hash of the currently installed dependencies to the hash of
+    // the currently existing composer.json. This will ensure that changes to
+    // composer.json will force an update to Drush's dependencies.
+    $hashFile = DRUSH_BASE_PATH . '/vendor/.composer/drush.md5.txt';
+    $hash = file_exists($hashFile) ? file_get_contents($hashFile) : FALSE;
+
+    // If drush.md5.txt exists, we compare it to the hash of composer.json.
+    $composerFile = DRUSH_BASE_PATH . '/composer.json';
+    $composerHash = $hash ? md5_file($composerFile) : TRUE;
+    if ($composerHash != $hash) {
+      // Since the hashes are different, we need to update the dependencies by
+      // running an installation through Composer.
+      if (drush_bootstrap_composer_update($composerFile, DRUSH_BASE_PATH)) {
+        // Composer was installed successfully, so save the composer.json hash.
+        file_put_contents($hashFile, md5_file($composerFile));
+      }
+    }
+
+    // Now that the dependencies are installed and up to date, we will initaite
+    // the Composer autoloader.
+    $composer = require_once(DRUSH_BASE_PATH . '/vendor/.composer/autoload.php');
+  }
+
+  return $composer;
+}
+
+/**
+ * Installs the given composer.json file into the given path.
+ *
+ * @param $composerFile
+ *   The Composer installation file to process. If not provided, will default to
+ *   the composer.json file in the current working directory.
+ * @param $path
+ *   The path to install the Composer dependencies. If not provided, will
+ *   default to the current working directory.
+ *
+ * @return
+ *   TRUE or FALSE whether or not composer.json was processed correctly.
+ *
+ * @see drush_bootstrap_composer()
+ */
+function drush_bootstrap_composer_update($composerFile = NULL, $path = NULL) {
+  // Load Composer from the .phar file.
+  require_once('phar://' . DRUSH_BASE_PATH . '/vendor/composer/composer.phar/vendor/.composer/autoload.php');
+
+  // The Composer application uses the current working directory, so we'll
+  // mock it as the path as the current working directory.
+  if (isset($path)) {
+    $originalPath = getcwd();
+    chdir($path);
+    $path = $originalPath;
+  }
+
+  // Create the Composer Console IO mappings.
+  $io = new ConsoleIO(new ArrayInput(array()), new ConsoleOutput(), new HelperSet());
+
+  // Create the Composer and Installer objects using the provided composer.json.
+  $composer = Composer\Factory::create($io, $composerFile);
+  $installer = Composer\Installer::create($io, $composer);
+
+  // Set up the installer to install and update any dependencies.
+  $installer
+    ->setDryRun(FALSE) // Actually perform actions.
+    ->setVerbose(TRUE) // Output messages more frequently.
+    ->setPreferSource(TRUE) // Use package sources when possible.
+    ->setInstallRecommends(TRUE) // Retrieve recommended packages.
+    ->setInstallSuggests(TRUE) // Retrieve suggested packages too.
+    ->setUpdate(TRUE); // Update any dependencies during installation.
+
+  // Run the installation process, ignoring any PHP warnings that may pop up.
+  $installed = @$installer->run();
+
+  // Now that the dependencies have been installed, we can switch back to
+  // the original directory.
+  if (isset($path)) {
+    chdir($path);
+  }
+
+  return $installed;
+}
diff --git a/includes/environment.inc b/includes/environment.inc
index c7ff6b0..103d517 100644
--- a/includes/environment.inc
+++ b/includes/environment.inc
@@ -131,34 +131,6 @@ function drush_environment_lib() {
   }
 }
 
-function drush_environment_table_lib() {
-  // Try using the PEAR installed version of Console_Table.
-  $tablefile = 'Console/Table.php';
-  if (@file_get_contents($tablefile, FILE_USE_INCLUDE_PATH) === FALSE) {
-    $lib = drush_get_option('lib', DRUSH_BASE_PATH . '/lib');
-    $tablefile = $lib . '/Console_Table-' . DRUSH_TABLE_VERSION . '/Table.php';
-    // If it is not already present, download Console Table.
-    if (!drush_file_not_empty($tablefile)) {
-      // Attempt to remove the old Console Table file, from the legacy location.
-      // TODO: Remove this (and associated .git.ignore) in Drush 6.x.
-      $tablefile_legacy = DRUSH_BASE_PATH . '/includes/table.inc';
-      if (drush_file_not_empty($tablefile_legacy)) {
-        drush_op('unlink', $tablefile_legacy);
-      }
-
-      // Download and extract Console_Table, and confirm success.
-      if (drush_lib_fetch(DRUSH_PEAR_BASE_URL . 'Console_Table-' . DRUSH_TABLE_VERSION . '.tgz')) {
-        // Remove unneccessary package.xml file which ends up in /lib.
-        drush_op('unlink', $lib . '/package.xml');
-      }
-      if (!drush_file_not_empty($tablefile)) {
-        return drush_bootstrap_error('DRUSH_TABLES_LIB_NOT_FOUND', dt("Drush needs a copy of the PEAR Console_Table library in order to function, and the attempt to download this file automatically failed. To continue you will need to download the !version package from http://pear.php.net/package/Console_Table, extract it into !lib directory, such that Table.php exists at !tablefile.", array('!version' => DRUSH_TABLE_VERSION, '!tablefile' => $tablefile, '!lib' => $lib)));
-      }
-    }
-  }
-  require_once $tablefile;
-}
-
 /**
  * Returns the current working directory.
  *
diff --git a/lib/README.txt b/lib/README.txt
index 6e828ad..2a21a26 100644
--- a/lib/README.txt
+++ b/lib/README.txt
@@ -1,6 +1,7 @@
-Drush adds external libraries here; examples include the Console Table
-and lightweight httpserver.
+The lib directory is for classes provided by Drush that are original to Drush.
+All Drush-originated code must follow the PSR-0 naming convention for classes
+and namespaces as documented here:
 
-This directory should be writable by the first user who runs Drush so
-that these dependencies can be downloaded.  It may be set to read-only
-after that.
+https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
+
+The PSR-0 namespace for Drush-originated code is "Drush".
diff --git a/vendor/.gitignore b/vendor/.gitignore
new file mode 100644
index 0000000..9bb5d38
--- /dev/null
+++ b/vendor/.gitignore
@@ -0,0 +1,5 @@
+# Ignore everything but composer and README.txt
+pear-pear
+symfony
+youngj
+.composer
diff --git a/lib/README.txt b/vendor/README.txt
similarity index 100%
copy from lib/README.txt
copy to vendor/README.txt
diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE
new file mode 100644
index 0000000..2f0e8b7
--- /dev/null
+++ b/vendor/composer/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Nils Adermann, Jordi Boggiano
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/composer/README.md b/vendor/composer/README.md
new file mode 100644
index 0000000..d0ca984
--- /dev/null
+++ b/vendor/composer/README.md
@@ -0,0 +1,134 @@
+Composer - Package Management for PHP
+=====================================
+
+Composer is a package manager tracking local dependencies of your projects and libraries.
+
+See the [about page](http://packagist.org/about) on [packagist.org](http://packagist.org/) for more information.
+
+[![Build Status](https://secure.travis-ci.org/composer/composer.png)](http://travis-ci.org/composer/composer)
+
+Installation / Usage
+--------------------
+
+1. Download the [`composer.phar`](http://getcomposer.org/composer.phar) executable or use the installer.
+
+    ``` sh
+    $ curl -s http://getcomposer.org/installer | php
+    ```
+
+
+2. Create a composer.json defining your dependencies. Note that this example is
+a short version for applications that are not meant to be published as packages
+themselves. To create libraries/packages please read the [guidelines](http://packagist.org/about).
+
+    ``` json
+    {
+        "require": {
+            "monolog/monolog": ">=1.0.0"
+        }
+    }
+    ```
+
+3. Run Composer: `php composer.phar install`
+4. Browse for more packages on [Packagist](http://packagist.org).
+
+Installation from Source
+------------------------
+
+To run tests, or develop Composer itself, you must use the sources and not the phar
+file as described above.
+
+1. Run `git clone https://github.com/composer/composer.git`
+2. Download the [`composer.phar`](http://getcomposer.org/composer.phar) executable
+3. Run Composer to get the dependencies: `php composer.phar install`
+
+Global installation of composer (manual)
+----------------------------------------
+
+Since composer works with the current working directory it is possible to install it
+in a system wide way.
+
+1. Change into a directory in your path like `cd /usr/local/bin`
+2. Get composer `curl -s http://getcomposer.org/installer | php`
+3. Make the phar executeable `chmod a+x composer.phar`
+4. Change into a project directory `cd /path/to/my/project`
+5. Use composer as you normally would `composer.phar install`
+6. Optionally you can rename the composer.phar to composer to make it easier
+
+Global installation of composer (via homebrew)
+----------------------------------------------
+
+Installing via this homebrew formula will always get you the latest composer version.
+
+1. run `brew uninstall composer ; brew install --HEAD https://raw.github.com/gist/1574469/composer.rb`
+2. Change into a project directory `cd /path/to/my/project`
+3. Use composer as you normally would `composer.phar install`
+
+*You will see a warning "Warning: Cannot verify package integrity"; however,
+this is benign and expected.*
+
+Updating composer
+-----------------
+
+Running `php composer.phar self-update` or equivalent will update a phar
+install with the latest version.
+
+Configuration
+-------------
+
+Additional options for composer can be configured in `composer.json` by using the `config` section.
+
+``` json
+{
+    "config": {
+        "vendor-dir": "custom/path/for/vendor"
+    }
+}
+```
+
+* `vendor-dir`: The location to install vendor packages. The location can be supplied as an absolute or relative path but **must** be within the current working directory.
+
+Contributing
+------------
+
+All code contributions - including those of people having commit access -
+must go through a pull request and approved by a core developer before being
+merged. This is to ensure proper review of all the code.
+
+Fork the project, create a feature branch, and send us a pull request.
+
+To ensure a consistent code base, you should make sure the code follows
+the [Coding Standards](http://symfony.com/doc/2.0/contributing/code/standards.html)
+which we borrowed from Symfony.
+
+If you would like to help take a look at the [list of issues](http://github.com/composer/composer/issues).
+
+Community
+---------
+
+The developer mailing list is on [google groups](http://groups.google.com/group/composer-dev)
+IRC channels are available for discussion as well, on irc.freenode.org [#composer](irc://irc.freenode.org/composer)
+for users and [#composer-dev](irc://irc.freenode.org/composer-dev) for development.
+
+Requirements
+------------
+
+PHP 5.3+
+
+Authors
+-------
+
+Nils Adermann - <naderman@naderman.de> - <http://twitter.com/naderman> - <http://www.naderman.de><br />
+Jordi Boggiano - <j.boggiano@seld.be> - <http://twitter.com/seldaek> - <http://seld.be><br />
+
+See also the list of [contributors](https://github.com/composer/composer/contributors) who participated in this project.
+
+License
+-------
+
+Composer is licensed under the MIT License - see the LICENSE file for details
+
+Acknowledgments
+---------------
+
+This project's Solver started out as a PHP port of openSUSE's [Libzypp satsolver](http://en.opensuse.org/openSUSE:Libzypp_satsolver).
diff --git a/vendor/composer/composer.phar b/vendor/composer/composer.phar
new file mode 100755
index 0000000..eb97be4
Binary files /dev/null and b/vendor/composer/composer.phar differ
