定制 fleetlog/fleetlog-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fleetlog/fleetlog-php

最新稳定版本:v0.0.3

Composer 安装命令:

composer require fleetlog/fleetlog-php

包简介

Simple PHP Wrapper for Fleetlog API v2 calls

README 文档

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'));

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2015-06-24