download($url)); $zip = new \ZipArchive; $zip->open($target); // Once we have the Zip archive, we can open it and extract it // into the working directory. By convention, we expect the // archive to contain one root directory with the bundle. $zip->extractTo($work); $latest = File::latest($work)->getRealPath(); @chmod($latest, 0777); // Once we have the latest modified directory, we should be // able to move its contents over into the bundles folder // so the bundle will be usable by the develoepr. File::mvdir($latest, $path); @unlink($target); } /** * Download a remote zip archive from a URL. * * @param string $url * @return string */ protected function download($url) { $remote = file_get_contents($url); // If we were unable to download the zip archive correctly // we'll bomb out since we don't want to extract the last // zip that was put in the storage directory. if ($remote === false) { throw new \Exception("Error downloading bundle [{$bundle}]."); } return $remote; } }