lxlang/tankerkoenig-php-client

该软件包最新版本(0.0.1)没有可用的许可信息。

0.0.1 2017-08-18 12:00 UTC

This package is auto-updated.

Last update: 2024-09-24 10:28:24 UTC


README

Simple Client for tankstellenkoenig.de json api.

https://github.com/tankerkoenig/tankerkoenig-php-client/ 启发

安装

composer require lxlang/tankerkoenig-php-client

API-KEY

免费的 Tankerkönig-Spritpreis-API 在创意共享之下。

在这里获取您的API密钥: https://creativecommons.tankerkoenig.de

使用

初始化API客户端

use Lang\Tankerkoenig\ApiClient;
$apiClient = new ApiClient("your-api-key-here");

通过位置搜索加油站

// get over
$gasStations = $apiClient->search(
	50.538472, //lat
	8.649647, //lng
	$apiClient::TYPE_E10 //your type of fuel
);

//echo results for testing
print_r($gasStations);

加油站详情

//unique id of a gas station
$gasStationUuid = '51d4b6a2-a095-1aa0-e100-80009459e03a';

// returns an object of type \Lang\Tankerkoenig\GasStatsion
$gasStation = $apiClient->detail($gasStationUuid);
 
print_r($gasStation);