daniels / tankerkoenig-php-client
1.0.0
2022-07-29 07:55 UTC
Requires
- php: ^8.0.3
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^7.4.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.9
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-08-29 06:01:52 UTC
README
simpleclientfor tankstellenkoenig.de jsonapi。
灵感来源于 https://github.com/tankerkoenig/tankerkoenig-php-client/
从 https://github.com/lxlang/tankerkoenig-php-client 分支
安装
composer require daniels/tankerkoenig-php-client
API-KEY
免费的 Tankerkönig-Spritpreis-API 在创意共享下。
在此处获取您的API密钥: https://creativecommons.tankerkoenig.de
使用方法
初始化API客户端
use DanielS\Tankerkoenig\ApiClient;
$apiClient = new ApiClient("your-api-key-here");
通过位置搜索加油站
// get over
$petrolStations = $apiClient->search(
50.538472, //lat
8.649647, //lng
$apiClient::TYPE_E10 //your type of fuel
);
//echo results for testing
print_r($petrolStations);
加油站详细信息
//unique id of a petrol station
$petrolStationUuid = '51d4b6a2-a095-1aa0-e100-80009459e03a';
// returns an object of type \Lang\Tankerkoenig\PetrolStation
$petrolStation = $apiClient->detail($petrolStationUuid);
print_r($petrolStation);
按加油站列表显示当前价格
$prices = $apiClient->prices([
'51d4b6a2-a095-1aa0-e100-80009459e03a'
]);
//echo results for testing
print_r($prices);
投诉
$apiClient->complaint(
'51d4b6a2-a095-1aa0-e100-80009459e03a',
Complaint::WRONG_PRICE_E10,
1.599
);
变更日志
查看 CHANGELOG 获取更多信息。
贡献
如果您有改进此项目的建议,请Fork存储库并创建一个pull请求。您也可以简单地打开一个问题。别忘了给项目加星!再次感谢!
- Fork项目
- 创建您的功能分支(git checkout -b feature/AmazingFeature)
- 提交您的更改(git commit -m '添加一些AmazingFeature')
- 将更改推送到分支(git push origin feature/AmazingFeature)
- 打开一个pull请求
许可证
(状态:2022-07-29)
在MIT许可证下分发。
Copyright: (c) 2017 Tobias Lang
(c) 2022-present Daniel Seifert
This software is distributed under the MIT LICENSE.
有关完整的版权和许可信息,请参阅与此源代码一起分发的 LICENSE 文件。