PHPackages                             spatie/bpost-address-webservice - 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. spatie/bpost-address-webservice

ActiveLibrary[API Development](/categories/api)

spatie/bpost-address-webservice
===============================

API wrapper for bpost's address webservice

1.1.0(3y ago)1813.3k↓35.7%11MITPHPPHP ^7.1|^8.0

Since Feb 8Pushed 2y ago3 watchersCompare

[ Source](https://github.com/spatie/bpost-address-webservice)[ Packagist](https://packagist.org/packages/spatie/bpost-address-webservice)[ Docs](https://github.com/spatie/bpost-address-webservice)[ RSS](/packages/spatie-bpost-address-webservice/feed)WikiDiscussions main Synced 1mo ago

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

An API wrapper for bpost's address webservice
=============================================

[](#an-api-wrapper-for-bposts-address-webservice)

[![Latest Version on Packagist](https://camo.githubusercontent.com/343e6986549807b3480b252c59177cd409ea5d89bf3973e9ba87e964f4d7d6b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f62706f73742d616464726573732d776562736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/bpost-address-webservice)[![Build Status](https://camo.githubusercontent.com/8225d3d45b0f664b1195454beda52b6734a788e74660f3ba1133362580b28df8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f62706f73742d616464726573732d776562736572766963652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/bpost-address-webservice)[![Quality Score](https://camo.githubusercontent.com/c157207c0ed348e0ee3935c58a15050af23ce75fcf89250209229b42874e09b7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f62706f73742d616464726573732d776562736572766963652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/bpost-address-webservice)[![StyleCI](https://camo.githubusercontent.com/f60485cff8f4ab79345a69217305aa86b6d56cdc9bf4278512db3e17b2d5025b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136333330343734372f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/163304747)[![Total Downloads](https://camo.githubusercontent.com/bce535bbd0f299e4a4f1f512c4f2aa5403afe72c7316848e1dee1b5c3c6c89b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f62706f73742d616464726573732d776562736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/bpost-address-webservice)

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](https://www.bpost.be/site/en/webservice-address).

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/6fedefcf7afdd089d3cf7cd2e7c0c38733e5c13aff3349e4bfd0d5bd40d6e18e/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f62706f73742d616464726573732d776562736572766963652e6a70673f743d31)](https://spatie.be/github-ad-click/bpost-address-webservice)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

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](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/bpost-address-webservice
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

### Security

[](#security)

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

Postcardware
------------

[](#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](https://spatie.be/en/opensource/postcards).

Credits
-------

[](#credits)

- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 61.9% 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 ~618 days

Total

3

Last Release

1420d ago

PHP version history (2 changes)1.0.0PHP ^7.1

1.1.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (26 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (7 commits)")[![webcraft](https://avatars.githubusercontent.com/u/56675?v=4)](https://github.com/webcraft "webcraft (1 commits)")

---

Tags

belgiumgeophpvalidatorspatiebpost-address-webservice

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spatie-bpost-address-webservice/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-bpost-address-webservice/health.svg)](https://phpackages.com/packages/spatie-bpost-address-webservice)
```

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[spatie/laravel-fractal

An easy to use Fractal integration for Laravel applications

1.9k15.1M99](/packages/spatie-laravel-fractal)[spatie/dropbox-api

A minimal implementation of Dropbox API v2

3116.0M36](/packages/spatie-dropbox-api)[spatie/fractalistic

A developer friendly wrapper around Fractal

38715.3M8](/packages/spatie-fractalistic)[spatie/laravel-json-api-paginate

A paginator that plays nice with the JSON API spec

6314.7M46](/packages/spatie-laravel-json-api-paginate)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)

PHPackages © 2026

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