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);

$products = $inflow->products()->list([
    'limit' => 50,
]);

foreach ($products as $product) {
    echo $product['name'] ?? '', PHP_EOL;
}

$product = $inflow->products()->find('product-id-here');

$order = $inflow->salesOrders()->create([
    'customerId' => 'customer-id-here',
    'orderNumber' => 'SO-1042',
    'lines' => [
        [
            'productId' => 'product-id-here',
            'quantity'  => 2,
            'unitPrice' => 19.99,
        ],
    ],
]);

echo 'Created sales order: ', $order['id'] ?? '(no id)', PHP_EOL;

$levels = $inflow->inventory()->stockLevels([
    'productId' => 'product-id-here',
]);

$customer = $inflow->customers()->create([
    'name'  => 'Acme Inc.',
    'email' => '[email protected]',
]);

$vendors = $inflow->vendors()->list();

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));

// Variable products (parent + variants)
$groups = $inflow->productGroups()->list([
    '