businessprocess/geo-service-sdk
最新稳定版本:v1.3.1
Composer 安装命令:
composer require businessprocess/geo-service-sdk
包简介
Geo service sdk for php
README 文档
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');
Available Methods
| Methods | Description | Return value |
|---|---|---|
| getCountryWithCities | Get all countries with children | Collection |
| countries | Get all countries without details | Collection |
| country | Get country by id | Country |
| getCitiesByCountry | Get cities by country id | Collection |
| getById | Get model by id | BaseModel |
| getChildById | Get all children by parent id | Collection |
| getCountryByCode | Get country by code | Country |
| getCitiesByCode | Get cities by country code | Collection |
| search | Get all model by keyword | Collection |
| ping | Ping node | boolean |
| alive | Check is node is alive | boolean |
| isServiceId | Check is id belongs to geo service | boolean |
统计信息
- 总下载量: 5.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-20