- How do I install nickurt/laravel-postcodeapi in Laravel?
- Install it with Composer by running composer require nickurt/laravel-postcodeapi in your Laravel project. The service provider and facade are registered automatically through package auto-discovery, so you do not need to edit config/app.php on modern Laravel versions. Then publish the package config with php artisan vendor:publish and add your chosen driver and API key to your .env file.
- Which postcode and address providers does laravel-postcodeapi support?
- The package is a driver-based adapter, and the documentation names PostcodeAPI.nu and Pro6PP as the supported services for Dutch postcode and address lookups. Because everything sits behind a single facade and config entry, you switch providers in config instead of rewriting application code. Confirm the current driver list in the README and source before committing, since provider availability can change between releases.
- How do I configure the API key and driver for laravel-postcodeapi?
- Publish the package config file with php artisan vendor:publish, then set the driver name and credentials from environment variables so keys never live in source control. The package follows standard Laravel config conventions, so per-environment values work as expected. If you run php artisan config:cache in production, re-run it after changing any of these values.
- Does laravel-postcodeapi support Laravel 11, 12 and 13?
- The package description advertises Laravel 11.x, 12.x and 13.x, but Laravel 13 has not been released, so treat that claim with caution. Check the actual illuminate/support constraints in composer.json and the CI matrix in the repository rather than trusting the README alone. If the constraints are loose, pin the package version and run your own tests against the Laravel release you actually deploy.
- How do I look up a Dutch address by postcode and house number in Laravel?
- Resolve the package facade, or inject the underlying service, and call the lookup method with the postcode and house number, then read street, city and coordinates from the returned result. Keep a small mapping layer in your own code so the vendor's response shape never leaks into your domain models. The lookup is a synchronous HTTP request to a paid provider, so expect network latency unless you cache results.
- Can I add a custom postcode driver or swap providers without forking laravel-postcodeapi?
- The package is built around a driver abstraction selected in the config file, so moving between the shipped providers is just a configuration change. Whether you can register an in-house or alternative provider without forking depends on whether the repository documents a driver interface and how drivers are resolved at runtime, so verify that before planning an internal integration. The MIT license means forking and patching is always an option if no clean extension point exists.
- How can I test code that uses laravel-postcodeapi without calling the real API?
- Because the package exposes a facade over the provider's HTTP calls, you can mock or swap it in the container so no real requests leave your test suite. Laravel's HTTP fake also works if the package routes requests through the framework's HTTP client. Whichever approach you use, hide the calls behind your own interface so tests stay hermetic, offline and fast.
- Does laravel-postcodeapi handle caching, retries or rate limiting?
- Expect this package to be a thin adapter: at most a config-level cache TTL, with retries, backoff, circuit breaking and quota awareness left as your responsibility. Wrap lookups in your own cache keyed by postcode and house number, and add timeouts and retry logic through the HTTP client. Verify the real caching and error behaviour in the source before relying on it in checkout or onboarding flows.
- Is laravel-postcodeapi free to use?
- The package itself is MIT licensed and free to install, fork and patch, but the underlying providers are commercial services that bill per lookup. You need a vendor account and API key, and you should review price, quota, SLA and termination terms before going live. Treat lookups as an ongoing operating cost rather than a one-off dependency.
- What happens when a postcode is not found or the provider returns an error?
- Adapters like this typically return null or an empty result for a genuine miss and throw an exception on transport or auth failures such as 401, 429 or 5xx, but you must confirm the exact error contract in the source before shipping. Handle the not-found case explicitly so a failed lookup never silently becomes an empty address in your UI. Also catch transport exceptions and decide whether to retry, degrade gracefully or surface an error to the user.