PHP code example of daniel-jorg-schuppelius / datev-php-sdk
1. Go to this page and download the library: Download daniel-jorg-schuppelius/datev-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 / datev-php-sdk example snippets
use APIToolkit\API\Authentication\BasicAuthentication;
use Datev\API\Desktop\Client;
$authentication = new BasicAuthentication('Benutzer', 'Passwort');
$client = new Client($authentication, 'https://127.0.0.1:58452');
use APIToolkit\API\Authentication\BearerAuthentication;
use Datev\API\Desktop\Client;
$authentication = new BearerAuthentication(
'your-api-key',
['X-Datev-Client-ID' => 'your-client-id']
);
$client = new Client($authentication, 'https://127.0.0.1:58452');
use APIToolkit\API\Authentication\BasicAuthentication;
use Datev\API\Desktop\Client;
use Datev\API\Desktop\Endpoints\Accounting\ClientsEndpoint;
$client = new Client(new BasicAuthentication('user', 'password'));
$endpoint = new ClientsEndpoint($client);
// Alle Mandanten abrufen
$clients = $endpoint->get();
// Einzelnen Mandanten abrufen
$singleClient = $endpoint->get(id: $clientId);
use APIToolkit\API\Authentication\BasicAuthentication;
use Datev\API\Desktop\Client;
use Datev\API\Desktop\Endpoints\Payroll\EmployeesEndpoint;
$client = new Client(new BasicAuthentication('user', 'password'));
$endpoint = new EmployeesEndpoint($client);
// Mitarbeiter mit Referenzdatum abrufen (erforderlich für HR-Endpoints)
$employees = $endpoint->get(referenceDate: new DateTime('2024-01-01'));
use APIToolkit\API\Authentication\BasicAuthentication;
use Datev\API\Desktop\Client;
use Datev\API\Desktop\Endpoints\Diagnostics\EchoEndpoint;
$client = new Client(new BasicAuthentication('user', 'password'));
$echoEndpoint = new EchoEndpoint($client);
$response = $echoEndpoint->get();
use APIToolkit\API\Authentication\BearerAuthentication;
use Datev\API\Online\{Client, OnlineService};
$client = new Client(
OnlineService::AccountingClients,
new BearerAuthentication($accessToken),
'meine-datev-client-id', // X-DATEV-Client-Id
sandbox: true // /platform-sandbox statt /platform
);
// ApiKey-only-Dienste (Kassenarchiv, Health-Endpunkte):
$cashClient = Client::forApiKey(OnlineService::CashRegister, $clientId, $clientSecret);