repository.php 668 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?php namespace Laravel\CLI\Tasks\Bundle;

class Repository {

	/**
	 * The root of the Laravel bundle API.
	 *
	 * @var string
	 */
	protected $api = 'http://bundles.laravel.com/api/';

	/**
	 * Get the decoded JSON information for a bundle.
	 *
	 * @param  string|int  $bundle
	 * @return array
	 */
	public function get($bundle)
	{
		// The Bundle API will return a JSON string that we can decode and
		// pass back to the consumer. The decoded array will contain info
		// regarding the bundle's provider and location, as well as all
		// of the bundle's dependencies.
		$bundle = @file_get_contents($this->api.$bundle);

		return json_decode($bundle, true);
	}

}