businessprocess/geo-service-sdk

Geo service sdk for php

v1.3.0 2023-11-30 08:57 UTC

This package is auto-updated.

Last update: 2024-08-30 01:32:42 UTC


README

PHP 8.x Laravel 8.x Yii 2.x Latest Stable Version Release date Release Version Total Downloads Pull requests Software License Stars

Geo Service SDK is a PSR-compatible PHP package for working with geo service api.

API Documentation

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');

Available Methods