This directory contains examples of how to use the Rebilly PHP SDK for PHP version v3.0. Below, there are instructions for running the code examples. Check out Rebilly API docs for more SDK examples.
- PHP version ^8.0.
- Create a Rebilly API key (use sandbox environment for testing).
See API keys for more information.
-
Install package dependencies via Composer:
composer install
-
Go to the examples directory:
cd ./examples
-
Add the API key and organization ID to the client parameters in the purchase.php and pagination.php files.
$client = new Client([ 'baseUrl' => Client::SANDBOX_HOST, 'organizationId' => '{organizationId}', 'apiKey' => '{secretKey}', ]);
-
Run the purchase script:
php purchase.php
-
Run the pagination script:
php pagination.php
-
authJwt.php: This example shows how to use the JWT authentication method. The result should be the list of products for the given organization as in the pagination.php; the difference is that when creating the client object, the parameter
sessionToken
is provided. -
createEntity.php: This example shows how to create a new entity in two ways, one through the setters methods and another with the
from
array method.