Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jeppos/skanetrafiken-php-api-client

Skånetrafiken API client for PHP.
https://github.com/jeppos/skanetrafiken-php-api-client

api-client api-wrapper php php71 skanetrafiken

Last synced: about 2 months ago
JSON representation

Skånetrafiken API client for PHP.

Awesome Lists containing this project

README

        

skanetrafiken-php-api-client
==
A simple Skånetrafiken PHP API client.

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/11f57782e049471ba15ed0622cb1b108)](https://www.codacy.com/app/jeppos/skanetrafiken-php-api-client?utm_source=github.com&utm_medium=referral&utm_content=jeppos/skanetrafiken-php-api-client&utm_campaign=Badge_Grade)
[![Build Status](https://travis-ci.org/jeppos/skanetrafiken-php-api-client.svg?branch=master)](https://travis-ci.org/jeppos/skanetrafiken-php-api-client)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/11f57782e049471ba15ed0622cb1b108)](https://www.codacy.com/app/jeppos/skanetrafiken-php-api-client?utm_source=github.com&utm_medium=referral&utm_content=jeppos/skanetrafiken-php-api-client&utm_campaign=Badge_Coverage)

# Installation
## Composer

```
composer require jeppos/skanetrafiken-php-api-client
```

# Usage

Following example shows how to get upcoming departures from Malmö C.

```php
use Jeppos\SkanetrafikenApiClient\SerializerFactory;
use Jeppos\SkanetrafikenApiClient\Service\DepartureBoard;

$guzzleClient = new \GuzzleHttp\Client([
'base_uri' => 'http://www.labs.skanetrafiken.se/v2.2/' // Version 2.2 of Skånetrafiken API
]);

$departureBoard = new DepartureBoard($guzzleClient, SerializerFactory::create());
$departureBoard->setStopAreaId(80000); // 80000 = Malmö C
$departureBoard->call();

$response = $departureBoard->getResponse();
```