businessprocess / geo-service-sdk
Geo service sdk for php
Installs: 3 494
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.4|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- laravel/framework: ^9.0
- laravel/pint: ^1.1
- phpunit/phpunit: ^9.3.3
README
Geo Service SDK is a PSR-compatible PHP package for working with geo service api.
Installation
The recommended way to install Geo service is through Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of Guzzle:
composer require businessprocess/geo-service-sdk
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
You can then later update Guzzle using composer:
composer update
Usage
$client = new \GeoService\Service\GeoService(); // set locale if we need $client->setLocale('en') $response = $client->countries(); print $response->all(); # '[{"id": ...}'
Usage Laravel
$response = \GeoService\Facade\Geo::setLocale('ru')->countries(); print $response->all(); # '[{"id": ...}' $citiesAndTowns = \GeoService\Facade\Geo::getCitiesByCountry('r60199'); //get only cities, default city,town $cities = \GeoService\Facade\Geo::getCitiesByCountry('r60199', 'city');