2017 © Pedro Peláez
 

library crs-request

Send HTTP request to the CRS router easily.

image

neo/crs-request

Send HTTP request to the CRS router easily.

  • Thursday, January 12, 2017
  • by CreativityKills
  • Repository
  • 2 Watchers
  • 5 Stars
  • 582 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 36 Versions
  • 4 % Grown

The README.md

HNG Request

Make requests to the HNG CRS api easily., (*1)

How to use basically

Pull in the package from composer "neo/crs-request":"1.*". Thats all. A sample implementation is below., (*2)

<?php

// Helper functions.... you can implement this however you want...
function saveCrsApiSession(array $session) {
    $path = 'path/to/storage/accesstoken.txt';
    file_put_contents($path, json_encode($session));
}

function getCrsApiSession() {
    $path = 'path/to/storage/accesstoken.txt';
    if (file_exists($path)) {
        return json_decode(file_get_contents($path), true);
    }

    return [];
}


// Using Lumen Router...
try {

    // Configuration details...
    $config  = [
        'base_url'      => 'http://crsapi.dev',
        'client_id'     => '12345',
        'client_secret' => 'SUPER_SECRET_CLIENT_SECRET',
        'scopes'        => ['scope1', 'scope2'],
    ];

    // Use Guzzle...
    $guzzle  = new HNG\Http\GuzzleRequest($config);

    // Get the stored session details and set it to the request class,
    // This is to avoid multiple calls to the service for authentication.
    $previouslyStoredSession = getCrsApiSession();

    // Create a request instance...
    $request = new HNG\Http\Request($guzzle, $config, $previouslyStoredSession);

    $bookings = $request->get('/bookings');

    saveCrsApiSession((array)$request->getSession());
} catch (\Exception $e) {
    // This should not really happen except your credentials are wrong...
    throw $e;
}

Debugging

Everytime an error occurs, the error details are logged in the log directory of your storage path set above. Here is an example of the logged information:, (*3)

[2016-12-05 03:16:52]
Endpoint: http://api.somesite.com/posts
Error:    cURL error 56: Problem (2) in the Chunked-Encoded data (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

The Versions

12/01 2017

dev-master

9999999-dev

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

12/01 2017

v1.2.19

1.2.19.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

05/12 2016

v1.2.18

1.2.18.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

05/12 2016

v1.2.17

1.2.17.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

05/12 2016

v1.2.16

1.2.16.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

05/12 2016

v1.2.15

1.2.15.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

03/12 2016

v1.2.14

1.2.14.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

03/12 2016

v1.2.13

1.2.13.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

03/12 2016

v1.2.12

1.2.12.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

03/12 2016

v1.2.11

1.2.11.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

03/12 2016

v1.2.10

1.2.10.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

03/12 2016

v1.2.9

1.2.9.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/11 2016

v1.2.8

1.2.8.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

25/11 2016

v1.2.7

1.2.7.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

25/11 2016

v1.2.6

1.2.6.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

11/11 2016

v1.2.5

1.2.5.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

03/11 2016

v1.2.4

1.2.4.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

01/11 2016

v1.2.3

1.2.3.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

11/09 2016

v1.2.2

1.2.2.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

11/09 2016

v1.2.1

1.2.1.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

11/09 2016

v1.2.0

1.2.0.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

11/09 2016

v1.1.9

1.1.9.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

30/07 2016

v1.1.8

1.1.8.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

29/07 2016

v1.1.7

1.1.7.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

29/07 2016

v1.1.6

1.1.6.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

29/07 2016

1.1.5

1.1.5.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

29/07 2016

v1.1.4

1.1.4.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

29/07 2016

v1.1.3

1.1.3.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/07 2016

v1.1.2

1.1.2.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/07 2016

v1.1.1

1.1.1.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/07 2016

v1.1.0

1.1.0.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/07 2016

v1.0.4

1.0.4.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/07 2016

v1.0.3

1.0.3.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/07 2016

v1.0.2

1.0.2.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

28/07 2016

v1.0.1

1.0.1.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro

27/07 2016

v1.0.0

1.0.0.0

Send HTTP request to the CRS router easily.

  Sources   Download

MIT

The Requires

 

by Neo Ighodaro