Changelog

PHP SDK

ideal-postcodes/sdk is our PHP SDK for the Ideal Postcodes API. It has one typed method for every API operation, sends requests through the PSR-18 HTTP client already in your project and runs on PHP 8.2 or later. A Symfony bundle and a Laravel package wire it into each framework.

Details

  • Every operation: Postcode lookup, address search and autocomplete, UPRN lookup, address cleanse, places, email and phone validation, plus key, licensee and configuration management
  • Any HTTP client: Guzzle, Symfony HttpClient or any other PSR-18 client, found by php-http/discovery. There is no bundled transport to configure
  • Typed responses: Every response is a read-only object generated from the OpenAPI spec, and each dataset's native record has its own class, from PafAddress to UspsAddress
  • Static analysis friendly: Parameters are PHPStan array shapes and enums are literal types, so a misspelt argument fails analysis before the code runs
  • Typed errors: An HTTP error throws ApiException, with the HTTP status from getStatusCode() and the API error code from getCode()
  • Symfony bundle: ideal-postcodes/symfony-bundle configures your keys once and injects the client into your services. Symfony 6.4, 7 or 8
  • Laravel package: ideal-postcodes/laravel reads your keys from .env and provides the client through the container or an IdealPostcodes facade. Laravel 12 or 13
  • Agent skill: npx skills add ideal-postcodes/skills gives coding agents the ideal-postcodes-php-sdk skill

Install with composer require ideal-postcodes/sdk, then start with the PHP SDK documentation.