darkling / php-zomato-client
Zomato PHP API 客户端
0.2
2018-12-17 19:08 UTC
Requires
- php: >=7.1
- dogma/dogma: ^0.1.10
- guzzlehttp/guzzle: ^6.0|^5.0|^4.0
- nette/http: ^2.4
Requires (Dev)
- consistence/coding-standard: ^3.0
- nette/tester: ^2.1
- phpstan/phpstan: ^0.10
- phpstan/phpstan-strict-rules: ^0.10
- slevomat/coding-standard: ^4.0
This package is auto-updated.
Last update: 2024-09-18 07:49:31 UTC
README
PHP 编写的 Zomato API 客户端。支持Zomato APIv2.1。
安装
只需使用 composer。
composer require darkling/php-zomato-client
用法
// Create request $request = new RestaurantRequest(16506740); // restaurant ID // OR //$request = RestaurantRequest::createFromParameters(['res_id' => 16506740]); // Name of parameters must respect name of parameters in zomato api documentation // Create client // You can choose from three possible output options (JSON_STRING, JSON_ARRAY, JSON_STD_CLASS) $client = new ZomatoClient('userApiKey', ResponseOption::get(ResponseOption::JSON_STRING)); // Send request and get response $response = $client->send($request); // Handle response if ($response->isOk()) { var_dump($response->getData()); } else { var_dump($response->getStatusCode()); var_dump($response->getReasonPhrase()); }
请求
可用请求列表
- /categories 获取分类列表 -> 未实现
- /cities 获取城市详情 -> 未实现
- /collections 获取城市中的 Zomato 收藏 -> 未实现
- /cuisines 获取城市中所有菜系列表 -> 未实现
- /establishments 获取城市中的餐厅类型列表 -> 未实现
- /geocode 基于坐标获取位置详情 -> 未实现
- /location_details 获取 Zomato 位置详情 -> 未实现
- /locations 搜索位置 -> 未实现
- /dailymenu 获取餐厅每日菜单 -> DailyMenuRequest
- /restaurant 获取餐厅详情 -> RestaurantRequest
- /reviews 获取餐厅评论 -> ReviewsRequest
- /search 搜索餐厅 -> SearchRequest
如果您需要使用尚未实现的请求,欢迎发送 PR :-)
Nette
如果您正在寻找与 Nette 框架 的集成,请使用此包 daaarkling/nette-zomato-client。
许可
新 BSD 许可证