Skip to content

anton-vakulchyk/Geocoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geocoding

spl_autoload_register(function($className) {
    $className = ltrim($className, '\\');
    if (0 != strpos($className, 'Geocoding')) {
        return false;
    }
    $fileName = '';
    $namespace = '';
    if ($lastNsPos = strrpos($className, '\\')) {
        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }
    $fileName = __DIR__ . DIRECTORY_SEPARATOR . $fileName . $className . '.php';
    if (is_file($fileName)) {
        require $fileName;

        return true;
    }

    return false;
});

$geocoding = new \Geocoding\Geocoding(
    new \Geocoding\Service\GoogleMapsService(
        false
    )
);

$geocodingResult = $geocoding->locate('1 Infinite Loop, Cupertino, CA');
echo $geocodingResult->getCountry();

About

Geocoding

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages