/rebilly-php

SDK for PHP

Primary LanguagePHPMIT LicenseMIT

Rebilly SDK for PHP

Latest Version on Packagist Software License Build Status Total Downloads Coverage Status

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

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:
composer require 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 7.1+.
  • 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 Rebilly REST APIs documentation for more details.

Tests

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

# run the test
phpunit