for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Stevebauman\Location\Drivers;
use Exception;
use Illuminate\Support\Fluent;
use Stevebauman\Location\Position;
class GeoPlugin extends Driver
{
/**
* {@inheritdoc}
*/
protected function url($ip)
return "http://www.geoplugin.net/php.gp?ip=$ip";
}
protected function hydrate(Position $position, Fluent $location)
$position->countryCode = $location->geoplugin_countryCode;
$position->countryName = $location->geoplugin_countryName;
$position->regionName = $location->geoplugin_regionName;
$position->regionCode = $location->geoplugin_regionCode;
$position->cityName = $location->geoplugin_city;
$position->latitude = $location->geoplugin_latitude;
$position->longitude = $location->geoplugin_longitude;
$position->areaCode = $location->geoplugin_areaCode;
return $position;
protected function process($ip)
try {
$response = unserialize($this->getUrlContent($this->url($ip)));
return new Fluent($response);
} catch (Exception $e) {
return false;