Helper to use Google's StreetView, Maps, Distance... APIs

dev-master 2020-10-21 13:49 UTC

This package is auto-updated.

Last update: 2024-04-24 15:17:58 UTC


README

Google\Position

new Google\Position(
	bool $throw_exceptions_on_error = true,
	bool $log_errors = true,
	string $api_key = Config::get('google','api_key')
)

Geocoding

(new Google\Position)
	->setAddress('Place Charges de Gaulle, 75008 Paris, France')
	->getPosition(); // array

More options

->getLatitude() // float
->getLongitude() // float

Reverse geocoding

(new Google\Position)
	->setPosition(
		48.8737917, 
		2.2950275
	)
	->getAddress(); // string

More options

->getStreet() // string
->getStreetNumber() // string
->getZipCode()  // string
->getCity() // string
->getCountry() // string

Google\Photo

  • Retrieve a photo url from streetview
$photo_url = (new \Google\Photo)
//	->position($lat,$lnt)
	->option(['key'=>'YourGoogleApiKeyHere'])
	->address('Some normal address')
	->size(500,500)
	->url();

Google\Map

  • Retrieve a static map url with a marker
$map_url = (new \Google\Map)
	->option(['key'=>'YourGoogleApiKeyHere'])
	->center($lat, $lng);
	->zoom(7)
	->retina(true)
	->marker($lat, $lng)
	->size(600,600)
	->url();