The GSALES PHP library provides convenient and easy access to the GSALES 3 REST API from applications written in the PHP language.
It includes a pre-defined set of classes for API resources and entities that makes it fast forward for developers to interact with GSALES 3.
PHP 8 and later.
You can install the bindings via Composer. Run the following command:
composer require gedankengut/gsales-api-php
To use the bindings, use Composer's autoload:
require_once 'vendor/autoload.php';
Simple usage looks like:
<?php
require_once 'vendor/autoload.php';
$clientBuilder = new \Gsales\ClientBuilder();
$clientBuilder->addPlugin(new \Http\Client\Common\Plugin\HeaderDefaultsPlugin(['Authorization' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx']));
$clientOptions = new \Gsales\Options(['client_builder' => $clientBuilder,'api_uri' => 'https://mydomain.de/gsales3/api']);
$gsales = new \Gsales\Client($clientOptions);
$gsales->articles()->get()
For more examples how to use the Client Library in detail see examples/gsales-client.php
file.