mistrfilda / pid-api
使用 guzzle/http 客户端进行 PID api 集成
v0.3.6
2021-04-27 12:34 UTC
Requires
- php: >=7.3
- ext-json: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^6.3 || ^7.0
- nette/http: ^3.0
- nette/schema: ^1.0
- nette/utils: ^3.0
- psr/http-client: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- mockery/mockery: ^1.2
- nette/tester: ^2.2
- php-parallel-lint/php-console-highlighter: ^0.5.0
- php-parallel-lint/php-parallel-lint: ^1.2
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12
- phpstan/phpstan-deprecation-rules: ^0.12.6
- phpstan/phpstan-mockery: ^0.12.3
- phpstan/phpstan-strict-rules: ^0.12
- roave/security-advisories: dev-master
- symplify/easy-coding-standard-prefixed: ~7.2.0
- tracy/tracy: ^2.6
README
安装
composer require mistrfilda/pid-api
Golemio
目前支持 API V2 - https://api.golemio.cz/v2
- 更多关于 API 的信息请参阅 https://golemioapi.docs.apiary.io/
使用方法
- 获取访问令牌 - https://golemioapi.docs.apiary.io/
- 使用带有端点的准备好的类的实例
$golemioService = new \Mistrfilda\Pid\Api\GolemioService('Your access token');
支持端点和方法
每个响应都返回包含获取的响应的数据值对象。例如,获取站点返回 Stop 响应对象
- GTFS 站点 (https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-stops/get-all-gtfs-stops) -
$golemioService->sendGetStopsRequest();
- GTFS 路线 (https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-trips/get-all-gtfs-trips) -
$golemioService->sendGetStopTripsRequest();
- GTFS 站点时间 (https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-stops-times/get-gtfs-stop-times) -
$golemioService->sendGetStopTimesRequest();
- 车辆位置 (https://golemioapi.docs.apiary.io/#reference/public-transport/vehicle-positions/get-all-vehicle-positions) -
$golemioService->sendGetVehiclePositionRequest();
- 停车场 (https://golemioapi.docs.apiary.io/#reference/parking/parking-lots/get-all-parking-lots) -
$golemioService->sendGetParkingLotRequest
RSS 订阅
使用方法
$rssService = new \Mistrfilda\Pid\Api\RssService();
支持的订阅
更多关于 RSS 订阅的信息请参阅此处 https://pid.cz/rss-kanal/。
- 计划中的交通限制 - 长期 (https://pid.cz/feed/rss-vyluky) -
$rssService->getLongTermRestrictions()
- 当前的交通限制 - 短期 (https://pid.cz/feed/rss-mimoradnosti) -
$rssService->getShortTermRestrictions()