PHP code example of daniel-jorg-schuppelius / orgamax-php-sdk

1. Go to this page and download the library: Download daniel-jorg-schuppelius/orgamax-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/ */

    

daniel-jorg-schuppelius / orgamax-php-sdk example snippets


use Orgamax\API\Client;

// Variante 1: kompletter Auth-Flow (holt das Bearer-Token selbst)
$client = Client::fromCredentials('api-key', 'api-secret', 'ownership-id');

// Variante 2: vorhandenes Bearer-Token direkt verwenden
$client = new Client($token);

// Optional: eigener PSR-3-Logger und Request-Throttling
$client = new Client($token, Client::DEFAULT_BASE_URL, $logger, true);

// Optional: eigener Guzzle-Transport (Test-MockHandler, Proxy, Timeouts).
// Die Ziel-URL baut der Client vollständig selbst — eine base_uri des
// injizierten Clients ist nicht nötig.
$client = new Client($token, Client::DEFAULT_BASE_URL, $logger, false, $guzzle);

use Orgamax\API\Endpoints\ArticlesEndpoint;
use Orgamax\Entities\Articles\Article;

$articles = new ArticlesEndpoint($client);

$resource = $articles->create(new Article([
    'title' => 'My Article',
    'unit' => 'Stk.',
    'number' => '0015',
    'price' => 200.25,
    'vatPercent' => 19,
]));
echo $resource->getData()?->getId(); // "90"

$list = $articles->search(['limit' => 20, 'search' => 'My']);
echo $list?->getMeta()?->getTotalCount();
foreach ($list?->getValues() ?? [] as $article) {
    echo $article->getTitle();
}

use APIToolkit\Entities\ID;
use Orgamax\API\Endpoints\CustomersEndpoint;
use Orgamax\Entities\Customers\Customer;

$customers = new CustomersEndpoint($client);

$response = $customers->create(new Customer([
    'customerDefaultAddress' => [
        'billingAddress' => ['kind' => 'person', 'lastName' => 'Müller'],
    ],
]));

$customer = $customers->get(new ID(6507));
echo $customer?->getName();

use APIToolkit\Entities\ID;
use Orgamax\API\Endpoints\InvoicesEndpoint;
use Orgamax\Entities\Invoices\InvoicePayment;

$invoices = new InvoicesEndpoint($client);

$invoice = $invoices->get(new ID(74));
$invoices->addPayment(new ID(74), new InvoicePayment([
    'amount' => 12.37,
    'type' => 'payment',
    'date' => '2026-07-26',
]));

file_put_contents('rechnung.pdf', $invoices->document(new ID(74)));

use APIToolkit\Entities\ID;
use Orgamax\API\Endpoints\FilesEndpoint;

$files = new FilesEndpoint($client);
$fileData = $files->upload('/pfad/zum/beleg.pdf', 'Rechnungseingang', ['#projekt-a']);
$analysis = $files->analyze(new ID(12));
echo $analysis?->getPayee();
bash
php tools/check-endpoint-coverage.php   # SDK-Abdeckung gegen die OpenAPI-Spec prüfen