1. Go to this page and download the library: Download canaltp/navitia 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 / navitia example snippets
php
namespace App\Service;
use Navitia\Component\Service\ServiceFacade;
class Navitia
{
private ServiceFacade $navitiacomponent;
function __construct(ServiceFacade $navitiacomponent)
{
$this->navitiacomponent = $navitiacomponent;
// Configuration
$config = array(
'url' => 'api.navitia.io',
'token' => '3b036afe-4242-abcd-4242-99718476c2e0', // Example of token
);
$this->navitiacomponent->setConfiguration($config);
}
}
php
$query = array(
'api' => 'journeys',
'parameters' => array(
'from' => '2.3749036;48.8467927',
'to' => '2.2922926;48.8583736',
),
);
$result = $this->navitiacomponent->call($query); // Returns an object with Api result