{"id":19324969,"url":"https://github.com/spatie/bpost-address-webservice","last_synced_at":"2025-04-22T20:30:52.597Z","repository":{"id":34048689,"uuid":"163304747","full_name":"spatie/bpost-address-webservice","owner":"spatie","description":"An API wrapper for bpost's address webservice","archived":false,"fork":false,"pushed_at":"2024-01-11T08:46:07.000Z","size":56,"stargazers_count":16,"open_issues_count":0,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T03:43:21.165Z","etag":null,"topics":["belgium","geo","php","validator"],"latest_commit_sha":null,"homepage":"https://spatie.be/open-source","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-27T14:41:31.000Z","updated_at":"2025-03-30T02:45:04.000Z","dependencies_parsed_at":"2022-08-08T00:00:12.354Z","dependency_job_id":null,"html_url":"https://github.com/spatie/bpost-address-webservice","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fbpost-address-webservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fbpost-address-webservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fbpost-address-webservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fbpost-address-webservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/bpost-address-webservice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250318602,"owners_count":21410960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["belgium","geo","php","validator"],"created_at":"2024-11-10T02:08:06.822Z","updated_at":"2025-04-22T20:30:52.370Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An API wrapper for bpost's address webservice\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/bpost-address-webservice.svg?style=flat-square)](https://packagist.org/packages/spatie/bpost-address-webservice)\n[![Build Status](https://img.shields.io/travis/spatie/bpost-address-webservice/master.svg?style=flat-square)](https://travis-ci.org/spatie/bpost-address-webservice)\n[![Quality Score](https://img.shields.io/scrutinizer/g/spatie/bpost-address-webservice.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/bpost-address-webservice)\n[![StyleCI](https://github.styleci.io/repos/163304747/shield?branch=master)](https://github.styleci.io/repos/163304747)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/bpost-address-webservice.svg?style=flat-square)](https://packagist.org/packages/spatie/bpost-address-webservice)\n\nThe Belgian mail service, Bpost, has an API to \n\nCreate an `\\Spatie\\BpostAddressWebservice\\Address`, and validate it.\n\n```php\n$addressValidator = AddressValidator::create();\n\n$address = Address::create([\n    'streetName' =\u003e 'Samberstraat',\n    'streetNumber' =\u003e '69',\n    'boxNumber' =\u003e 'D',\n    'postalCode' =\u003e '2060',\n    'municipalityName' =\u003e 'Antwaarpe',\n    'country' =\u003e 'BELGIE',\n]);\n\n$validatedAddress = $addressValidator-\u003evalidate($address);\n```\n\nThe validated address can contain *errors* and *warnings*. If it has any *error* or *warning*, we say that it has *issues*.\n\n```php\n$validatedAddress-\u003ehasErrors(); // false\n\n$validatedAddress-\u003ehasWarnings(); // true\n\n$validatedAddress-\u003ehasIssues(); // true\n```\n\nAn array of errors, warnings, or issues can be retrieved from the validated address.\n\n```php\n$validatedAddress-\u003eerrors(); // []\n\n$validatedAddress-\u003ewarnings()[0]-\u003eattribute(); // 'municipalityName'\n$validatedAddress-\u003ewarnings()[0]-\u003emessage(); // 'anomaly_in_field'\n\n$validatedAddress-\u003eissues()[0]-\u003eattribute(); // 'municipalityName'\n$validatedAddress-\u003eissues()[0]-\u003emessage(); // 'anomaly_in_field'\n```\n\nA validated addresses' attributes can be retrieved.\n\n```php\n$validatedAddress-\u003estreetName; // 'Samberstraat'\n$validatedAddress-\u003estreetNumber; // '69'\n$validatedAddress-\u003eboxNumber; // ''\n$validatedAddress-\u003epostalCode; // '2060'\n$validatedAddress-\u003emunicipalityName; // 'Antwaarpe'\n$validatedAddress-\u003ecountry; // 'BELGIE'\n\n$validatedAddress-\u003etoArray();\n// [\n//     'streetName' =\u003e 'SAMBERSTRAAT',\n//     'streetNumber' =\u003e '69',\n//     'boxNumber' =\u003e '',\n//     'postalCode' =\u003e '2060',\n//     'municipalityName' =\u003e 'ANTWERPEN',\n//     'country' =\u003e 'BELGIE',\n// ]\n```\n\nYou can also validate up to 100 addresses at a time. An array of `ValidatedAddresses` will be returned.\n\n```php\n$addressValidator = AddressValidator::create();\n\n$validatedAddresses = $addressValidator-\u003evalidateMany([\n    Address::create([\n        'streetName' =\u003e 'Samberstraat',\n        'streetNumber' =\u003e '69',\n        'boxNumber' =\u003e 'D',\n        'postalCode' =\u003e '2060',\n        'municipalityName' =\u003e 'Antwaarpe',\n        'country' =\u003e 'BELGIE',\n    ]),\n    // ...\n]);\n```\n\nAddress webservice documentation is available on [bpost.be](https://www.bpost.be/site/en/webservice-address).\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/bpost-address-webservice.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/bpost-address-webservice)\n\nWe 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).\n\nWe 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).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require spatie/bpost-address-webservice\n```\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n### Security\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Postcardware\n\nYou'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.\n\nOur address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.\n\nWe publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).\n\n## Credits\n\n- [Sebastian De Deyne](https://github.com/sebastiandedeyne)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fbpost-address-webservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Fbpost-address-webservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fbpost-address-webservice/lists"}