PHP code example of canaltp / navitiaio-api-component

1. Go to this page and download the library: Download canaltp/navitiaio-api-component library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

canaltp / navitiaio-api-component example snippets

 php
$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
}
 php
$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);