mistrfilda / pid-api
PID api integration using guzzle/http client
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
Instalation
composer require mistrfilda/pid-api
Golemio
Currently supports V2 of API - https://api.golemio.cz/v2
- more about api on https://golemioapi.docs.apiary.io/
Usage
- Obtain access token - https://golemioapi.docs.apiary.io/
- Use new instance of prepared class with endpoints
$golemioService = new \Mistrfilda\Pid\Api\GolemioService('Your access token');
Supported endpoints with methods:
Each response returns data value object with obtained response. For example, get stops returns Stop response object
- GTFS stops (https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-stops/get-all-gtfs-stops) -
$golemioService->sendGetStopsRequest();
- GTFS trips (https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-trips/get-all-gtfs-trips) -
$golemioService->sendGetStopTripsRequest();
- GTFS stoptimes (https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-stops-times/get-gtfs-stop-times) -
$golemioService->sendGetStopTimesRequest();
- Vehicle positions (https://golemioapi.docs.apiary.io/#reference/public-transport/vehicle-positions/get-all-vehicle-positions) -
$golemioService->sendGetVehiclePositionRequest();
- Parkings (https://golemioapi.docs.apiary.io/#reference/parking/parking-lots/get-all-parking-lots) -
$golemioService->sendGetParkingLotRequest
Endpoint | API doc url | Golemio service method |
---|---|---|
GTFS stops | https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-stops/get-all-gtfs-stops | $golemioService->sendGetStopsRequest(); |
GTFS trips | https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-trips/get-all-gtfs-trips | $golemioService->sendGetStopTripsRequest(); |
GTFS stoptimes | https://golemioapi.docs.apiary.io/#reference/public-transport/gtfs-stops-times/get-gtfs-stop-times | $golemioService->sendGetStopTimesRequest(); |
Vehicle positions | https://golemioapi.docs.apiary.io/#reference/public-transport/vehicle-positions/get-all-vehicle-positions | $golemioService->sendGetVehiclePositionRequest(); |
Parkings | https://golemioapi.docs.apiary.io/#reference/parking/parking-lots/get-all-parking-lots | $golemioService->sendGetParkingLotRequest(); |
RSS feeds
Usage
$rssService = new \Mistrfilda\Pid\Api\RssService();
Supported feeds
More info about rss feeds can be found here https://pid.cz/rss-kanal/.
- Planned transport restrictions - long term (https://pid.cz/feed/rss-vyluky) -
$rssService->getLongTermRestrictions()
- Current transport restrictions - short term (https://pid.cz/feed/rss-mimoradnosti) -
$rssService->getShortTermRestrictions()