PHP code example of erpflow / erpflow-php

1. Go to this page and download the library: Download erpflow/erpflow-php 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/ */

    

erpflow / erpflow-php example snippets




RPFlow\Client;

$erpflow = new Client($_ENV['ERPFLOW_API_KEY']);

$organization = $erpflow->organization()->get();

$erpflow->organization();
$erpflow->documentBlocks();
$erpflow->bankAccounts();
$erpflow->partners();
$erpflow->products();
$erpflow->documents();
$erpflow->receipts();
$erpflow->spendings();
$erpflow->exports();
$erpflow->utils();

$partner = $erpflow->partners()->create([
    'name' => 'Minta Kft.',
    'taxcode' => '12345678-2-42',
    'emails' => ['[email protected]'],
    'address' => [
        'country_code' => 'HU',
        'post_code' => '1051',
        'city' => 'Budapest',
        'address' => 'Minta utca 1.',
    ],
]);

$invoice = $erpflow->documents()->create([
    'vendor_id' => 'order-10001',
    'partner_id' => $partner['id'],
    'block_id' => 1,
    'type' => 'invoice',
    'fulfillment_date' => '2026-10-04',
    'due_date' => '2026-10-12',
    'payment_method' => 'wire_transfer',
    'language' => 'hu',
    'currency' => 'HUF',
    'electronic' => true,
    'items' => [[
        'name' => 'Szolgáltatás',
        'unit_price' => 10000,
        'unit_price_type' => 'net',
        'quantity' => 1,
        'unit' => 'db',
        'vat' => '27%',
    ]],
], 'order-10001');

use ERPFlow\Exception\ApiException;

try {
    $document = $erpflow->documents()->get(123);
} catch (ApiException $e) {
    echo $e->getMessage();
    echo $e->statusCode();
}

$pdf = $erpflow->documents()->download(123);

file_put_contents('invoice.pdf', $pdf->body());

$erpflow = new Client(
    'api-key',
    'https://api.erpflow.hu/v3',
    30,
    $customTransport
);
bash
composer