New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

spatie/bpost-address-webservice

API wrapper for bpost's address webservice
20,266 19

Larablocks Analysis

Compatibility

Trusted maintainer

spatie/bpost-address-webservice works with any PHP project: the latest release (1.1.0, Jun 29, 2022) doesn't depend on Laravel.

  • Trusted maintainer: spatie publishes 287 packages on Larablocks, with 204,800,870 downloads a month between them.

Recommendation checks

Use with care

Use with care: meets 0 of 3 checks.

  • No release in the last 12 months (last: Jun 29, 2022)
  • 1,802 downloads a month (needs 10,000)
  • 19 GitHub stars (needs 100)

State

Quiet
  • Last stable release: Jun 29, 2022.
  • No releases in the last 12 months.
  • First released: Feb 8, 2019.
  • Monthly downloads: 1,802.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 29, 2026.

Install
composer require spatie/bpost-address-webservice
Latest Version:1.1.0
PHP:^7.1|^8.0
License:MIT
Last Updated:Oct 22, 2026
Links: GitHub  ·  Packagist
Maintainer: spatie

An API wrapper for bpost's address webservice

Latest Version on Packagist Build Status Quality Score StyleCI Total Downloads

The Belgian mail service, Bpost, has an API to

Create an \Spatie\BpostAddressWebservice\Address, and validate it.

$addressValidator = AddressValidator::create();

$address = Address::create([
    'streetName' => 'Samberstraat',
    'streetNumber' => '69',
    'boxNumber' => 'D',
    'postalCode' => '2060',
    'municipalityName' => 'Antwaarpe',
    'country' => 'BELGIE',
]);

$validatedAddress = $addressValidator->validate($address);

The validated address can contain errors and warnings. If it has any error or warning, we say that it has issues.

$validatedAddress->hasErrors(); // false

$validatedAddress->hasWarnings(); // true

$validatedAddress->hasIssues(); // true

An array of errors, warnings, or issues can be retrieved from the validated address.

$validatedAddress->errors(); // []

$validatedAddress->warnings()[0]->attribute(); // 'municipalityName'
$validatedAddress->warnings()[0]->message(); // 'anomaly_in_field'

$validatedAddress->issues()[0]->attribute(); // 'municipalityName'
$validatedAddress->issues()[0]->message(); // 'anomaly_in_field'

A validated addresses' attributes can be retrieved.

$validatedAddress->streetName; // 'Samberstraat'
$validatedAddress->streetNumber; // '69'
$validatedAddress->boxNumber; // ''
$validatedAddress->postalCode; // '2060'
$validatedAddress->municipalityName; // 'Antwaarpe'
$validatedAddress->country; // 'BELGIE'

$validatedAddress->toArray();
// [
//     'streetName' => 'SAMBERSTRAAT',
//     'streetNumber' => '69',
//     'boxNumber' => '',
//     'postalCode' => '2060',
//     'municipalityName' => 'ANTWERPEN',
//     'country' => 'BELGIE',
// ]

You can also validate up to 100 addresses at a time. An array of ValidatedAddresses will be returned.

$addressValidator = AddressValidator::create();

$validatedAddresses = $addressValidator->validateMany([
    Address::create([
        'streetName' => 'Samberstraat',
        'streetNumber' => '69',
        'boxNumber' => 'D',
        'postalCode' => '2060',
        'municipalityName' => 'Antwaarpe',
        'country' => 'BELGIE',
    ]),
    // ...
]);

Address webservice documentation is available on bpost.be.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require spatie/bpost-address-webservice

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

spatie/elasticsearch-search-string-parser

Build Elasticsearch queries based of a query string

24,619 51
spatie/backtrace

A better backtrace

220,267,784 438
spatie/laravel-package-tools

Tools for creating Laravel packages

208,094,001 952
spatie/image-optimizer

Easily optimize images using PHP

100,292,189 2,882
spatie/error-solutions

This is my package error-solutions

92,435,565 67

Version History

Version Released PHP License
1.1.0 ^7.1|^8.0 MIT
1.0.1 ^7.1 MIT
1.0.0 ^7.1 MIT