fleetlog / fleetlog-php
Simple PHP Wrapper for Fleetlog API v2 calls
v0.0.3
2015-12-17 15:38 UTC
Requires
- ext-curl: *
Requires (Dev)
- phpunit/phpunit: ~4.5,>=4.5.1
This package is not auto-updated.
Last update: 2025-07-19 21:52:18 UTC
README
Fleetlog API wrapper
- Include the class in your PHP code
- Set your access_token to FleetlogAPI
- Make request
Installation
Normally: Include TwitterAPIExchange.php in your application.
Composer: Add to your composer.json file to have FleetlogAPI.php automatically imported into your vendors folder:
{
"require": {
"fleetlog/fleetlog-php": "dev-master"
}
}
Of course, you'll then need to run php composer.phar update
.
How To Use
Include the class file
require_once('FleetlogAPI.php');
Obtain an access token (client_credentials grant)
$body = array( 'grant_type' => 'client_credentials', 'client_id' => 'yourCLientId', 'client_secret' => 'yourClientSecret' ); $customHeaders = ['Content-type: application/x-www-form-urlencoded']; $fleetlog = new \FleetlogAPI(); $resultBody = $fleetlog->request('token', 'POST', $body, $customHeaders); echo json_encode($resultBody); $fleetlog->setAccessToken($resultBody->access_token); $vehicles = $fleetlog->request('vehicles', 'GET'); echo json_encode($vehicles);
GET Request Example
[GET] https://api.fleetlog.com.au/v2/vehicles/222
$settings = array( 'oauth_access_token' => "your_access_token", ); $requestMethod = 'GET'; $fleetlog = new FleetlogAPI($settings); echo json_encode($fleetlog->request('vehicles/222', 'GET'));
[GET] https://api.fleetlog.com.au/v2/vehicles/222/positions
$settings = array( 'oauth_access_token' => "your_access_token", ); $requestMethod = 'GET'; $fleetlog = new FleetlogAPI($settings); echo json_encode($fleetlog->request('vehicles/222/positions', 'GET'));