/rebilly-php

https://www.rebilly.com SDK for PHP

Primary LanguagePHPMIT LicenseMIT

Rebilly SDK for PHP

Build Status Coverage Status Packagist Version Total Downloads GitHub license

The Rebilly SDK for PHP makes it easy for developers to access Rebilly REST APIs in their PHP code. You can get started in minutes by installing the SDK through Composer or by downloading a single zip file from our latest release.

Installation

There are two supported methods of installing the Rebilly SDK for PHP. The recommended way to install the SDK is through Composer.

Using Composer is the recommended way to install the Rebilly SDK for PHP. To get started, you need run the Composer commands (assume you're in the project's root directory).

  • Install the latest stable version of the SDK:
php composer.phar require rebilly/client-php
  • Update the dependencies:
php composer.phar update rebilly/client-php

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

Requirements

  • PHP 5.5+ (tested with 5.5, 5.6, 7.0). We recommend you use PHP 7.0.
  • CURL (verify peer requires a root certificate authority -- if you have not configured php curl to use one, and your system libs aren't linked to one, you may need to do a manual configuration to use the appropriate certificate authority)
  • PHPUnit (tests only)

Quick Examples

Create a Rebilly Client

use Rebilly\Client;

// Instantiate an Rebilly client.
$client = new Client([
  'apiKey' => ApiKeyProvider::env(),
  'baseUrl' => Client::SANDBOX_HOST,
]);

Create a Customer

$form = new Customer();
$form->setFirstName('Sarah');
$form->setLastName('Connor');

try {
  $customer = $client->customers()->create($form);
} catch (UnprocessableEntityException $e) {
  var_dump($e->getErrors());
}

Documentation

Read https://www.rebilly.com/api/documentation/ for more details.

Tests

# install required files
$ composer self-update
$ composer install

# run the test (from project root)
phpunit