PHPackages                             budgetlens/intrapost - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. budgetlens/intrapost

ActiveLibrary[API Development](/categories/api)

budgetlens/intrapost
====================

Fluent PHP client for the Intrapost API (mail, parcels, track &amp; trace)

v1.0.1(1mo ago)0384MITPHPPHP ^8.2

Since Apr 10Pushed 1mo agoCompare

[ Source](https://github.com/123lens/laravel-intrapost-rest-client)[ Packagist](https://packagist.org/packages/budgetlens/intrapost)[ RSS](/packages/budgetlens-intrapost/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Intrapost PHP Client
====================

[](#intrapost-php-client)

Fluent PHP client for the [Intrapost API](https://api.intrapost.nl) — create shipments, generate labels, track parcels, and manage daily mail orders for PostNL, DHL, and GLS.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- [Composer](https://getcomposer.org/)
- An Intrapost API key and account number (request via [Intrapost](https://www.intrapost.nl))

Installation
------------

[](#installation)

```
composer require budgetlens/intrapost
```

Configuration
-------------

[](#configuration)

### Standalone PHP

[](#standalone-php)

```
use Budgetlens\Intrapost\IntrapostClient;

$client = new IntrapostClient(
    apiKey: 'your-api-key',
    accountNumber: 'your-account-number',
);
```

### Laravel

[](#laravel)

The package includes auto-discovery, so the service provider and facade are registered automatically.

**Publish the config file:**

```
php artisan vendor:publish --tag=intrapost-config
```

**Add to your `.env`:**

```
INTRAPOST_API_KEY=your-api-key
INTRAPOST_ACCOUNT_NUMBER=your-account-number
INTRAPOST_BASE_URL=https://api.intrapost.nl
INTRAPOST_TIMEOUT=30
```

**Use via dependency injection or facade:**

```
use Budgetlens\Intrapost\IntrapostClient;
use Budgetlens\Intrapost\Laravel\Facades\Intrapost;

// Dependency injection
public function __construct(private IntrapostClient $client) {}

// Facade
Intrapost::mailPiece()->create()-> ...
```

Welke API gebruik je wanneer?
-----------------------------

[](#welke-api-gebruik-je-wanneer)

De Intrapost API is opgedeeld in vier resources. Hieronder staat wanneer je welke gebruikt:

### Mail Piece vs. Track &amp; Trace

[](#mail-piece-vs-track--trace)

Dit is het belangrijkste onderscheid:

Mail PieceTrack &amp; Trace**Wat**Brieven en ongeregistreerde poststukkenPakketten met track &amp; trace**Wanneer**Reguliere post versturen (brieven, kaarten, kleine poststukken tot 2kg)Pakketten versturen die gevolgd moeten worden**Tracking**Geen volledige track &amp; trace — alleen registratie en labelVolledige track &amp; trace met VZ-code en trackinglink**Gewicht**In grammen (1-2000g)In kilogrammen**Producten**Standard, FixedDays12 producttypen (standaard, verzekerd, aangetekend, brievenbuspakket, avondlevering, etc.)**Extra opties**Beperkt (afmetingen, projectcode)Uitgebreid (afmetingen, afhaalpunt, customs, handtekening, leeftijdscheck, etc.)**Vuistregel:** Verstuur je een brief of ongeregistreerd poststuk? Gebruik `mailPiece()`. Verstuur je een pakket dat gevolgd moet worden? Gebruik `trackTrace()`.

### Overzicht van alle calls

[](#overzicht-van-alle-calls)

MethodeGebruik wanneer...**Mail Piece**`mailPiece()->create()`Je een nieuw poststuk wilt registreren en een label wilt genereren`mailPiece()->order()`Je de dagelijkse bestelling van geregistreerde poststukken wilt ophalen (verzamelorder)`mailPiece()->getLabel()`Je het label van een eerder aangemaakt poststuk opnieuw wilt ophalen**Track &amp; Trace**`trackTrace()->create()`Je een nieuw pakket wilt aanmelden met track &amp; trace (de meest gebruikte call)`trackTrace()->createMailboxParcel()`Je specifiek een brievenbuspakket wilt aanmaken met ZPL-label`trackTrace()->createLabels()`Je labels voor meerdere zendingen in 1 bestand wilt genereren`trackTrace()->getRetourLabel()`Je een retourlabel wilt aanmaken voor een bestaande zending`trackTrace()->cancel()`Je een zending wilt annuleren (voordat deze is verwerkt)`trackTrace()->search()`Je zendingen wilt zoeken op datum, postcode, referentie, etc.`trackTrace()->getFromId()`Je zendingen wilt ophalen op basis van hun Piece ID (max. 50 per keer)`trackTrace()->getFromVz()`Je zendingen wilt ophalen op basis van hun VZ-code (max. 50 per keer)**Order (Daily Mail)**`order()->createDailyMailOption1()`Dagelijkse postbestelling aanmaken (optie 1)`order()->createDailyMailOption2()`Dagelijkse postbestelling aanmaken (optie 2)`order()->createDailyMailOption3()`Dagelijkse postbestelling aanmaken (optie 3)**Utility**`utility()->lookupAddress()`Je een adres wilt valideren/opzoeken op basis van postcode + huisnummer`utility()->productCodes()`Je wilt opvragen welke productcodes beschikbaar zijn voor jouw account`utility()->pickupPointsForAddress()`Je afhaalpunten wilt zoeken bij een adres (voor `ParcelViaPickupLocation`)`utility()->dropoffPointsForInternationalAddress()`Je inleverpunten wilt zoeken voor internationale zendingen### Typische flow

[](#typische-flow)

```
1. [Optioneel] utility()->lookupAddress()     — Valideer het afleveradres
2. [Optioneel] utility()->pickupPointsForAddress() — Zoek afhaalpunt (als klant dat wil)
3. trackTrace()->create() of mailPiece()->create() — Maak de zending aan, ontvang label
4. [Optioneel] trackTrace()->search()          — Zoek/volg zendingen
5. [Optioneel] trackTrace()->getRetourLabel()  — Genereer retourlabel indien nodig
6. [Optioneel] trackTrace()->cancel()          — Annuleer indien nodig

```

Usage
-----

[](#usage)

### Mail Pieces

[](#mail-pieces)

**Create a mail piece:**

```
use Budgetlens\Intrapost\Enums\MailPieceProduct;

$response = $client->mailPiece()->create()
    ->product(MailPieceProduct::Standard)
    ->weight(250)
    ->reference('ORDER-001')
    ->to('John Doe', '1234AB', '10', 'NL')
    ->send();

$response->shipmentId;   // "SHP-..."
$response->vzCode;       // Track & trace code
$response->labelData;    // Base64 label PDF
```

**Shorthand product methods:**

```
$client->mailPiece()->create()->standard()-> ...    // MailPieceProduct::Standard
$client->mailPiece()->create()->fixedDays()-> ...   // MailPieceProduct::FixedDays
```

**Order mail pieces:**

```
$response = $client->mailPiece()->order('ORDER-001');
```

**Get a label:**

```
$response = $client->mailPiece()->getLabel('SHP-123');
$response->labelData; // Base64 encoded label
```

### Track &amp; Trace Parcels

[](#track--trace-parcels)

**Create a shipment:**

```
use Budgetlens\Intrapost\Enums\TrackTraceProduct;

$response = $client->trackTrace()->create()
    ->standardParcel()
    ->weight(2.5)
    ->reference('REF-001')
    ->to('Jane Doe', '5678CD', '25', 'NL')
    ->dimensions(30, 20, 15)
    ->sendMailToRecipient()
    ->send();
```

**Available product shorthand methods:**

```
->standardParcel()    // StandardParcel
->insuredParcel()     // InsuredParcel
->registeredParcel()  // RegisteredParcel
->mailboxParcel()     // MailboxParcel
->eveningDelivery()   // StandardParcelWithEveningDelivery
->withAgeCheck()      // StandardParcelWithAgeCheck
->withSignature()     // StandardParcelSignature
->pickupLocation()    // ParcelViaPickupLocation
```

**Create a mailbox parcel:**

```
$response = $client->trackTrace()->createMailboxParcel()
    ->weight(0.8)
    ->to('Jane Doe', '5678CD', '25', 'NL')
    ->send();
```

**Generate labels:**

```
use Budgetlens\Intrapost\Enums\LabelFormatType;

$response = $client->trackTrace()->createLabels(
    shipmentIds: ['SHP-001', 'SHP-002'],
    format: LabelFormatType::Pdf150x100,
);
```

**Get a return label:**

```
$response = $client->trackTrace()->getRetourLabel()
    ->shipmentId('SHP-123')
    ->send();
```

**Cancel a shipment:**

```
$response = $client->trackTrace()->cancel('SHP-123');
```

**Search shipments:**

```
$response = $client->trackTrace()->search()
    ->dateRange('2025-01-01', '2025-01-31')
    ->zipcode('1234AB')
    ->includeHistory()
    ->get();

foreach ($response->shipments as $shipment) {
    $shipment->shipmentId;
    $shipment->status;
    $shipment->vzCode;
}
```

**Look up by ID or VZ code:**

```
$response = $client->trackTrace()->getFromId(['PIECE-001'], includeHistory: true);
$response = $client->trackTrace()->getFromVz(['3STEST123456789'], includeHistory: true);
```

### Pickup at a Service Point

[](#pickup-at-a-service-point)

```
use Budgetlens\Intrapost\Enums\CarrierType;

$response = $client->trackTrace()->create()
    ->pickupLocation()
    ->pickupAt(CarrierType::PostNL, 'LOCATION-ID', 'NL')
    ->to('Jane Doe', '5678CD', '25', 'NL')
    ->send();
```

### International Shipments with Customs

[](#international-shipments-with-customs)

```
use Budgetlens\Intrapost\DTOs\CustomsInfo;
use Budgetlens\Intrapost\DTOs\CustomsProduct;

$customs = new CustomsInfo(
    invoiceNumber: 'INV-2025-001',
    products: [
        new CustomsProduct(
            description: 'T-shirt',
            quantity: 2,
            weight: 0.3,
            value: 29.95,
            hsCode: '6109100010',
            countryOfOrigin: 'NL',
        ),
    ],
);

$response = $client->trackTrace()->create()
    ->standardParcel()
    ->to('John Smith', '10001', '100', 'US', city: 'New York')
    ->customsInfo($customs)
    ->send();
```

### Daily Mail Orders

[](#daily-mail-orders)

```
$response = $client->order()->createDailyMailOption1()
    // ... configure order
    ->send();
```

### Utilities

[](#utilities)

**Address lookup:**

```
$response = $client->utility()->lookupAddress('1234AB', 10);
$response->street;
$response->city;
```

**Product codes:**

```
$response = $client->utility()->productCodes();
```

**Pickup &amp; drop-off points:**

```
$points = $client->utility()->pickupPointsForAddress()
    ->zipcode('1234AB')
    ->countryCode('NL')
    ->get();

$points = $client->utility()->dropoffPointsForInternationalAddress()
    ->zipcode('1234AB')
    ->countryCode('NL')
    ->get();
```

Supported Carriers
------------------

[](#supported-carriers)

CarrierEnumPostNL`CarrierType::PostNL`DHL`CarrierType::DHL`GLS`CarrierType::GLS`Label Formats
-------------

[](#label-formats)

FormatEnumZPL Zebra 150x100mm`LabelFormatType::ZplZebra150x100`PDF 150x100mm`LabelFormatType::Pdf150x100`Error Handling
--------------

[](#error-handling)

The client throws specific exceptions for different error scenarios:

```
use Budgetlens\Intrapost\Exceptions\IntrapostAuthenticationException;
use Budgetlens\Intrapost\Exceptions\IntrapostApiException;
use Budgetlens\Intrapost\Exceptions\IntrapostException;

try {
    $response = $client->trackTrace()->create()
        ->standardParcel()
        ->to('Jane Doe', '5678CD', '25', 'NL')
        ->send();
} catch (IntrapostAuthenticationException $e) {
    // Invalid API key (401/403)
} catch (IntrapostApiException $e) {
    // API returned validation errors
    $e->getErrors(); // array of error messages
} catch (IntrapostException $e) {
    // Network or other errors
}
```

Testing
-------

[](#testing)

```
composer test
```

Code Style
----------

[](#code-style)

```
# Check for violations
composer lint

# Auto-fix
composer fix
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance88

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~45 days

Total

2

Last Release

59d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af0112579d392b0f20366a7a4acbcfe437c29edf24d795f17cef8c15331371a0?d=identicon)[123lens](/maintainers/123lens)

---

Top Contributors

[![avido](https://avatars.githubusercontent.com/u/14986?v=4)](https://github.com/avido "avido (3 commits)")

---

Tags

laravelshippingdhlpostnlparcelsglsintraposttrack-trace

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/budgetlens-intrapost/health.svg)

```
[![Health](https://phpackages.com/badges/budgetlens-intrapost/health.svg)](https://phpackages.com/packages/budgetlens-intrapost)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M1.0k](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[flat3/lodata

OData v4.01 Producer for Laravel

99351.7k](/packages/flat3-lodata)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
