public function setup($target)
    {
        $installer = tempnam(sys_get_temp_dir(), 'install');
        $handle = fopen($installer, 'w+');

        $request = $this->guzzle->get('https://getcomposer.org/installer', null, $handle);

        try {
            $response = $request->send();
            fclose($handle);
        } catch (GuzzleException $e) {
            fclose($handle);
            throw new RuntimeException('Unable to download composer install script.');
        }

        if (200 !== $response->getStatusCode()) {
            @unlink($installer);
            throw new RuntimeException('Unable to download composer install script.');
        }

        $dir = getcwd();
        if (!@chdir(dirname($target))) {
            throw new RuntimeException('Unable to move to target directory for composer install.');
        }

        $process = ProcessBuilder::create([$this->phpExecutable, $installer])
            ->setTimeout(300)
            ->getProcess()
        ;

        try {
            $process->run();
            @unlink($installer);
        } catch (ProcessException $e) {
            @unlink($installer);
            throw new RuntimeException('Unable run composer install script.');
        }

        if (!@rename(getcwd() . '/composer.phar', $target)) {
            throw new RuntimeException('Composer install failed.');
        }

        if (!@chdir($dir)) {
            throw new RuntimeException('Unable to move back to origin directory.');
        }

        if (!$process->isSuccessful()) {
            throw new RuntimeException('Composer install failed.');
        }

        if (!file_exists($target)) {
            throw new RuntimeException('Composer install failed.');
        }
    }