1. Go to this page and download the library: Download bapp/api-client 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/ */
bapp / api-client example snippets
use Bapp\BappApiClient;
$client = new BappApiClient(['token' => 'your-api-key']);
// List with filters
$countries = $client->list('core.country', ['page' => 1, 'search' => 'Romania']);
// Get by ID
$country = $client->get('core.country', '42');
// Create
$new = $client->create('core.country', ['name' => 'Romania', 'code' => 'RO']);
// Patch (partial update)
$client->patch('core.country', '42', ['code' => 'RO']);
// Delete
$client->delete('core.country', '42');
// Static API token (tenant is token' => 'your-api-key']);
// Bearer (JWT / OAuth)
$client = new BappApiClient(['bearer' => 'eyJhbG...', 'tenant' => '1']);
$client->tenant = '2';
$client->app = 'wms';
// CURLFile or SplFileInfo values trigger multipart/form-data automatically
$client->create('myapp.document', [
'name' => 'Report',
'file' => new \CURLFile('/path/to/report.pdf'),
]);
// Or use SplFileInfo
$client->create('myapp.document', [
'name' => 'Report',
'file' => new \SplFileInfo('/path/to/report.pdf'),
]);
$order = $client->get('company_order.order', '42');
// Get a PDF download URL (auto-detects public_view vs view_token)
$url = $client->getDocumentUrl($order, 'pdf');
// Pick a specific view by label
$url = $client->getDocumentUrl($order, 'html', 'Comanda interna');
// Use a variation
$url = $client->getDocumentUrl($order, 'pdf', null, 'v4');
// Fetch the actual content as bytes
$pdfBytes = $client->getDocumentContent($order, 'pdf');
file_put_contents('order.pdf', $pdfBytes);
// Enumerate all available views
$views = $client->getDocumentViews($order);
foreach ($views as $v) {
echo $v['label'] . ' ' . $v['type'] . PHP_EOL;
}
$tasks = $client->listTasks();
$cfg = $client->detailTask('myapp.export_report');
// Run without payload (GET)
$result = $client->runTask('myapp.export_report');
// Run with payload (POST)
$result = $client->runTask('myapp.export_report', ['format' => 'csv']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.