millermedia/brink-php

There is no license information available for the latest version (1.0.2) of this package.

A PHP wrapper to the Brink API

1.0.2 2017-10-03 23:07 UTC

This package is auto-updated.

Last update: 2024-04-15 01:55:43 UTC


README

687474703a2f2f6a6f696e6272696e6b2e636f6d2f6173736574732f696d616765732f7265706f2f4272696e6b2e706e67687474703a2f2f6a6f696e6272696e6b2e636f6d2f6173736574732f696d616765732f7265706f2f5048502d6c6f676f2e706e67

Install the PHP Package

    $ composer require millermedia/brink-php

Using the API

  1. Login to the api to receive a jwt token that can be used in future requests without the need to reauthenticate
	include("vendor/autoload.php");
	$brink_api = new \MillerMedia\Brink\Brink_API();

	// Login to the api via username and password
	$user_data = array(
		"username" => 'username',
		"password" => 'password'
	);
	$response = $brink_api->login($user_data);

	if (isset($response->error)) {
		// Login Error
		echo $response->error;
		exit;
	}
	$access_token = $response->jwt_token;

	// After logging in using the $brink_api->login() method, the token is already set
	// so additional requests can be handled correctly
	$flights = $brink_api->get_all_flights();
  1. If you already have a jwt token prepared, you can use it when creating the api instance and bypass logging in.
	include("Brink_API.php");
	$brink_api = new Brink_API();

	$token='eyJ0eXAiOiJKV1QiLCJhbGc...';
	$brink_api->access_token = $token;

	// Get all flights
	$flights = $brink_api->get_all_flights();

	// Get details for a specific flights
	$params = array('flight_id' => 12);
	$flight = $brink_api->get_flight($params);

	// Get data points for a specific flight
	$params = array('flight_id'=>15, 'prop' => array('page'=>1, 'per_page'=>5));
	$flight_data = $brink_api->get_flight_data($params);