1. Go to this page and download the library: Download scratchy2/billomat 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/ */
scratchy2 / billomat example snippets
use Phobetor\Billomat\Client\BillomatClient;
$billomat = new BillomatClient('my-id', 'my-api-key');
use Phobetor\Billomat\Client\BillomatClient;
$billomat = new BillomatClient('my-id', 'my-api-key', 'my-api-app-id', 'my-api-app-secret');
// Get the client with id 133713371337
$client = $billomat->getClient(array(
'id' => 133713371337
));
// Create a new client
$client = $billomat->createClient(array(
'client' => array(
'number' => 424242424242,
'name' => 'client-name'
)
));
// Fetch an invoice pdf file
$response = $billomat->getInvoicePdf(array(
'id' => 133713371337,
'format' => 'pdf'
));
$content = (string)$response->getBody();
try {
$client = $billomat->updateClient(array(
'id' => 133713371337,
'client' => array(
'number' => 424242424242,
'name' => 'client-name'
)
));
}
catch (\Phobetor\Billomat\Exception\NotFoundException $e) {
// There seems to be no such client.
}
catch (\Phobetor\Billomat\Exception\BadRequestException $e) {
// Some of the given data must have been bad. $e->getMessage() could help.
}
catch (\Phobetor\Billomat\Exception\TooManyRequestsException $e) {
// The rate limit was reached. $e->getRateLimitReset() returns the UTC timestamp of the next rate limit reset.
// @see http://www.billomat.com/en/api/basics/rate-limiting for details about the rate limit.
}
catch (\Phobetor\Billomat\ExceptionInterface $e) {
// Something else failed. Maybe there is no connection to the API servers.
}
use Phobetor\Billomat\Client\BillomatClient;
// setting the fifth parameter to true enables waiting for rate limit
$billomat = new BillomatClient('my-id', 'my-api-key', 'my-api-app-id', 'my-api-app-secret', true);