PHP code example of brixion / ulu-php

1. Go to this page and download the library: Download brixion/ulu-php 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/ */

    

brixion / ulu-php example snippets


use Brixion\Ulu\UluClient;

$ulu = UluClient::authenticate('[email protected]', 'your-password');
$token = $ulu->getAccessToken();

use Brixion\Ulu\UluClient;

$ulu = UluClient::withToken(getenv('ULU_TOKEN'));

$company = $ulu->companies()->me();
echo $company->name;

$vehicles = $ulu->vehicles()->list(page: 1, limit: 50);
foreach ($vehicles->items as $vehicle) {
    echo $vehicle->licensePlate;
}

$trips = $ulu->trips()->listForVehicle(
    vehicleId: 1376,
    fromStartAt: '2017-02-23T00:00',
    toStartAt: '2017-02-24T00:00',
);

$trip = $ulu->trips()->get(242070);
echo $trip->distance;

use Brixion\Ulu\Exception\ApiException;

try {
    $ulu->companies()->me();
} catch (ApiException $e) {
    echo $e->getMessage();
    print_r($e->getErrors());
}
bash
composer