postbode / postbode-api
Official supported client for Postbode.nu (https://postbode.nu)
Installs: 23 871
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: ^7.0 | ^8.0
- guzzlehttp/guzzle: ~6.0|^7.0.1
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2025-01-06 17:03:46 UTC
README
Getting started
- Register an account on Postbode.nu (https://app.postbode.nu)
- Create an API key (https://app.postbode.nu/settings/api)
Initialize composer package
composer require postbode/postbode-api
Complete documentation
Our complete API is available at https://api.postbode.nu
Usage
List all available mailboxes
$postbode = new \Postbode\PostbodeClient(API_KEY); $mailboxes = $postbode->getMailboxes(); foreach($mailboxes AS $mailbox){ // use $mailbox }
List all letters in mailbox
$postbode = new \Postbode\PostbodeClient(API_KEY); $letters = $postbode->getLetters(MAILBOX_ID); foreach($letters AS $letter){ // use $letter }
Send letter
$postbode = new \Postbode\PostbodeClient(API_KEY); $filename = 'example.pdf'; $envelope_id = 2; $country = 'NL'; $registered = false; // Registered letter $send_direct = false; // Create concept in mailbox $letter = $postbode->sendLetter(MAILBOX_ID, $filename, $envelope_id, $country, $registered, $send_direct); if(!is_array($letter)){ echo 'Failed! Errorcode: '.$letter; }else{ echo 'Letter sent!'; echo '<br /><pre>'; print_r($letter); }
Add letters to queue and send in one request
$postbode = new \Postbode\PostbodeClient(API_KEY); $envelope_id = 2; $country = 'NL'; $registered = false; // Registered letter $send_direct = false; // Create concept in mailbox $postbode->addLetterToQueue(MAILBOX_ID, 'Letter_A.pdf', $envelope_id, $country, $registered, $send_direct); $postbode->addLetterToQueue(MAILBOX_ID, 'Letter_B.pdf', $envelope_id, $country, $registered, $send_direct); $postbode->sendLetterQueue(); if(!is_array($letter)){ echo 'Failed! Errorcode: '.$letter; }else{ echo 'Letter sent!'; echo '<br /><pre>'; print_r($letter); }