rebilly / client-php
Rebilly PHP Client
Installs: 300 652
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 21
Forks: 20
Open Issues: 2
Requires
- php: ^8.0
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ~7.0
- guzzlehttp/psr7: ^1.0 || ^2.0
- psr/http-message: ^1.0 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.23
- vimeo/psalm: ^5.14
- dev-main / 3.x-dev
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.0
- 3.0.0-alpha
- v2.x-dev
- 2.24.0
- 2.23.1
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- v2.0.x-dev
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- v2.0.1-rc
- v2.0.1-beta
- v2.0.1-alpha
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.x-dev
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-automations/update-sdk-from-api-definitions
- dev-changeset-release/main
This package is auto-updated.
Last update: 2024-11-12 03:48:05 UTC
README
The Rebilly SDK for PHP makes it easy for developers to access Rebilly REST APIs in their PHP code.
Requirements
- PHP 8.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)
Installation
Warning
This package does not follow semantic versioning, so minor version updates can cause backward compatibility breaks. Updates to the package should be tested before switching versions.
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.
Supported Versions
The previous version of the SDK can be outdated and won't provide all (or the correct) specifications to communicate with the REST APIs. Only the latest version is constantly supported.
Quick Examples
Create a Rebilly Client
use Rebilly\Sdk\Client; use Rebilly\Sdk\Service; // Instantiate Rebilly client. $client = new Client([ 'baseUrl' => Client::SANDBOX_HOST, 'organizationId' => '{organizationId}', 'apiKey' => '{secretKey}', ]); $service = new Service(client: $client);
Create a Customer
use Rebilly\Sdk\Exception\DataValidationException; use Rebilly\Sdk\Model\ContactObject; use Rebilly\Sdk\Model\Customer; $customer = Customer::from([]) ->setWebsiteId('{websiteId}') ->setPrimaryAddress( ContactObject::from([]) ->setFirstName('John') ->setLastName('Doe'), ); try { $customer = $service->customers()->create($form); } catch (DataValidationException $e) { var_dump($e->getValidationErrors()); }
For more see examples directory.
Documentation
Read Rebilly REST APIs documentation for more details.
Migration from SDK v2.x to v3.x
This new major version brings several new helper classes to communicate with Rebilly REST APIs and some incompatibilities that should be tested before switching SDK versions.
-
Now, a
Service
class can be explicitly instantiated to make the API calls instead of using only theClient
, as it encapsulates the API calls. -
To simplify the migration from the previous version, the
Client
object can be used to make calls to any API directly. For example, instead of instantiating a service class, one can use:$client->customers()->create($form);
-
The namespace changed from
Rebilly\Entities
toRebilly\Sdk\Model
. Now, thesrc
isRebilly\Sdk
. -
The classes are now generated by an automated process that is triggered every time a new version of the API definitions is released. It means more frequency on the SDK updates, keeping it synced with the REST APIs.