2017 © Pedro Peláez
 

library regaliator

PHP client library for connecting to the Regalii API

image

regalii/regaliator

PHP client library for connecting to the Regalii API

  • Wednesday, February 1, 2017
  • by regalii
  • Repository
  • 8 Watchers
  • 0 Stars
  • 872 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 8 % Grown

The README.md

Regalii PHP Client

A PHP client for connecting to the Regalii API., (*1)

Usage

After requiring regalii/regaliator in your composer.json file, you can use the class like so:, (*2)

$configuration = new Regaliator\Configuration([
  'version' => '3.1',
  'api_host' => 'api.casiregalii.com',
  'api_key' => getenv('REGALII_API_KEY'),
  'secret_key' => getenv('REGALII_SECRET')
]);
$regaliator = new Regaliator\Regaliator($configuration);

$response = $regaliator->account();

if ($response->success) {
  $data = json_decode($response->body, true);
} else {
  echo "Failed with status code {$response->status_code}";
}

The $response will be a Response object from the Requests library., (*3)

Examples

Examples of some common use-cases:, (*4)

Creating a credential bill

$response = $regaliator->create_credentials_bill(12376, 'login', 'challengeme');
$bill = json_decode($response->body, true);
echo "Created bill {$bill['id']}\n";

Polling for while bill fetching

function poll_while_updating($regaliator, $id) {
  for($i = 0; $i < 60; $i++) {
    echo "Checking status for bill {$id} after sleeping 1 second\n";
    sleep(1);

    $response = $regaliator->show_bill($id);
    $bill = json_decode($response->body, true);

    if ($bill['status'] !== 'fetching') {
      return $bill;
    }
  }
  // raise exception because bill is still fetching
}

$bill = poll_while_updating($regaliator, $bill['id']);

Answering MFA Challenge

$response = $regaliator->update_bill_mfas($bill['id'], ['mfa_challenges' => [
  [
    'id' => $bill['mfa_challenges'][0]['id'],
    'type' => $bill['mfa_challenges'][0]['type'],
    'response' => '8'
  ]
]]);

The Versions

01/02 2017

dev-master

9999999-dev

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday

01/02 2017

1.0.1

1.0.1.0

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday

23/01 2017

1.0.0

1.0.0.0

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday

23/01 2017

1.0.0.x-dev

1.0.0.9999999-dev

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday

27/12 2016

0.3.0

0.3.0.0

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday

27/12 2016

0.3.0.x-dev

0.3.0.9999999-dev

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday

21/12 2016

0.2.2

0.2.2.0

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday

13/12 2016

0.2.1

0.2.1.0

PHP client library for connecting to the Regalii API

  Sources   Download

The Requires

 

by Leigh Halliday