PHP code example of abhisingh159 / inflow-cloud-php-sdk
1. Go to this page and download the library: Download abhisingh159/inflow-cloud-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
abhisingh159 / inflow-cloud-php-sdk example snippets
use Abhimanev\Inflow\Config;
use Abhimanev\Inflow\Inflow;
$config = new Config(
apiKey: getenv('INFLOW_API_KEY'),
companyId: getenv('INFLOW_COMPANY_ID'),
baseUrl: 'https://cloudapi.inflowinventory.com' // optional
);
$inflow = new Inflow($config);
use Abhimanev\Inflow\Exception\ApiException;
use Abhimanev\Inflow\Exception\InflowException;
try {
$inflow->salesOrders()->create($payload);
} catch (ApiException $e) {
error_log(sprintf(
'inFlow API failed [%d]: %s — body: %s',
$e->getStatusCode(),
$e->getMessage(),
$e->getResponseBody()
));
} catch (InflowException $e) {
error_log('inFlow transport error: ' . $e->getMessage());
}
use Abhimanev\Inflow\Client;
use Abhimanev\Inflow\Config;
use Abhimanev\Inflow\Inflow;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\HandlerStack;
$stack = HandlerStack::create();
// $stack->push(your_retry_middleware());
$http = new GuzzleClient([
'base_uri' => 'https://cloudapi.inflowinventory.com/',
'timeout' => 30,
'http_errors' => false,
'handler' => $stack,
]);
$config = new Config($apiKey, $companyId);
$inflow = new Inflow($config, new Client($config, $http));