canaltp / navitiaio-api-component
This package is abandoned and no longer maintained.
No replacement package was suggested.
PHP library which makes curl calls to NavitiaIo API.
1.6.1
2017-01-06 15:30 UTC
Requires
- php: >=5.2
- guzzle/guzzle: ^3.8.1
Requires (Dev)
- phpunit/phpunit: ~4.3
This package is not auto-updated.
Last update: 2022-01-26 06:27:21 UTC
README
PHP library which makes curl calls to NavitiaIo API.
Composer
Install via composer
{ "require": { "canaltp/navitiaio-api-component": "1.x" } }
Usage
Instanciate NavitiaIoService as a plain PHP object:
$navitiaIoApiUrl = 'http://navitia.local/'; $user = 'my_user' $password = '********' // Instanciating api $navitiaIoApiApi = new CanalTP\NavitiaIoApiComponent\NavitiaIoApiService($navitiaIoApiUrl, $user, $password); // Get users $response = $navitiaIoApiApi->getUsers(); foreach ($data->users as $user) { // Do something here }
Testing
Mock Guzzle client:
$navitiaIoApiUrl = 'http://navitiaIoApi.dev.canaltp.fr/v0/'; $user = 'my_user' $password = '********' $navitiaIoApiApi = new CanalTP\NavitiaIoApiComponent\NavitiaIoApiService($navitiaIoApiUrl, $user, $password); // Creating GuzzleHttp\Client mock... $navitiaIoApiApi->setClient($mockedClient);
License
This project is under GPL-3.0 License.