2017 © Pedro Peláez
 

library trafi

The Unofficial Trafi API for Laravel

image

abizareyhan/trafi

The Unofficial Trafi API for Laravel

  • Thursday, March 1, 2018
  • by abizareyhan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Trafi Unofficial SDK

The Unofficial SDK of Trafi for PHP., (*1)

About

Installation

Install Trafi Unofficial SDK using Composer., (*2)

$ composer require abizareyhan/trafi

After updating composer, add the ServiceProvider to the providers array in config/app.php, (*3)

Abizareyhan\Trafi\TrafiServiceProvider::class,

You can use the facade for shorter code:, (*4)

'Trafi' => Abizareyhan\Trafi\Facades\Trafi::class,

Usage

$client = new Abizareyhan\Trafi\HTTPClient\CurlHTTPClient();
$trafi = new Abizareyhan\Trafi\Trafi($client);

//Getting Current Events
$response = $trafi->getEvents();
$events = $response->getJSONDecodedBody();

//Getting Stops inside Bounds
$bounds = new Abizareyhan\Trafi\Bounds(
  [
    -6.0537830087495905, //Top Left Latitude
    106.63549041748047 //Top Left Longitude
  ],
  [
    -6.0537830087495905, //Top Right Latitude
    107.04747772216797 //Top Right Longitude
  ],
  [
    -6.1903288844762585, //Bottom Left Latitude
    106.63549041748047 //Bottom Left Longitude
  ],
  [
    -6.1903288844762585, //Bottom Right Latitude
    107.04747772216797 //Bottom Right Longitude
  ]
);

$response = $trafi->getStops($bounds);
$stops = $response->getJSONDecodedBody();

//Getting Transjakarta Realtime Coordinate inside Bounds
$bounds = new Abizareyhan\Trafi\Bounds(
  [
    -6.0537830087495905, //Top Left Latitude
    106.63549041748047 //Top Left Longitude
  ],
  [
    -6.0537830087495905, //Top Right Latitude
    107.04747772216797 //Top Right Longitude
  ],
  [
    -6.1903288844762585, //Bottom Left Latitude
    106.63549041748047 //Bottom Left Longitude
  ],
  [
    -6.1903288844762585, //Bottom Right Latitude
    107.04747772216797 //Bottom Right Longitude
  ]
);

$response = $trafi->getTransports($bounds);
$transports = $response->getJSONDecodedBody();

The Versions

01/03 2018

0.0.1

0.0.1.0

The Unofficial Trafi API for Laravel

  Sources   Download

BSD-3-Clause

by Muhammad Reyhan Abizar

01/03 2018

dev-master

9999999-dev

The Unofficial Trafi API for Laravel

  Sources   Download

BSD-3-Clause

by Muhammad Reyhan Abizar