{"id":19311060,"url":"https://github.com/boxuk/postcodes-io-bundle","last_synced_at":"2025-08-22T11:36:31.963Z","repository":{"id":19806899,"uuid":"23067052","full_name":"boxuk/postcodes-io-bundle","owner":"boxuk","description":"A bundle for querying the postcodes.io web service.","archived":false,"fork":false,"pushed_at":"2021-10-18T15:56:05.000Z","size":17,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-08-04T08:57:51.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/boxuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-18T10:21:47.000Z","updated_at":"2023-09-30T18:06:29.000Z","dependencies_parsed_at":"2022-08-21T14:40:44.857Z","dependency_job_id":null,"html_url":"https://github.com/boxuk/postcodes-io-bundle","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/boxuk/postcodes-io-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fpostcodes-io-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fpostcodes-io-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fpostcodes-io-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fpostcodes-io-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxuk","download_url":"https://codeload.github.com/boxuk/postcodes-io-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fpostcodes-io-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271630385,"owners_count":24793310,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-10T00:27:32.304Z","updated_at":"2025-08-22T11:36:31.905Z","avatar_url":"https://github.com/boxuk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PostcodesIoBundle\n=================\n\n[![Build Status](https://travis-ci.org/boxuk/postcodes-io-bundle.svg)](https://travis-ci.org/boxuk/postcodes-io-bundle)\n\nA bundle for querying the [postcodes.io](https://postcodes.io) web service.\n\n[https://github.com/BoxUk/postcodes-io-bundle](https://github.com/BoxUk/postcodes-io-bundle)\n\n[License](LICENSE)\n\n\nInstallation\n------------\n\nInstallation is handled via [Composer](https://getcomposer.org).\n\n1. Run the following command:\n    ```bash\n    $ composer require boxuk/postcodes-io-bundle ~1.0\n    ```\n    This should add the following to your project's `composer.json` file:\n\n    ```js\n    \"require\": {\n        \"boxuk/postcodes-io-bundle\": \"~1.0\"\n    }\n    ```\n2. Add the bundle to your `app/AppKernel.php` file:\n\n    ```php\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new BoxUk\\PostcodesIoBundle\\BoxUkPostcodesIoBundle()\n        );\n    }\n    ```\n\n\nServices\n--------\n\nThis bundle adds two services to your container:\n\n* `box_uk_postcodes_io.client` A [GuzzleHttp\\Client](https://github.com/guzzle/guzzle-services) configured to query the postcodes.io service.\n* `box_uk_postcodes_io.client_factory` A factory used to create instances of the client.\n\n\nUsage\n-----\n\nInject the `box_uk_postcodes_io.client` service into your controller/class as you would any other service.  Once you have the instance of the client, you can call the methods documented below on it, passing any parameters as an associative array.\n\nThe response will be a `GuzzleHttp\\Command\\Model` object, which you can access as an array, e.g. `echo $response['result']['latitude']`.  Alternatively, you can just call `$response-\u003etoArray()` to get an array representation of the response.  For further documentation on the structure of the response, please see [the postcodes.io documentation](https://postcodes.io/docs#Data).\n\n\nMethods\n-------\n\nlookup()\n--------\n[API documentation](https://postcodes.io/docs#Postcode-Lookup)\n\nLookup data about a particular postcode.\n\n__Parameters:__\n* `postcode` _(Required)_: The postcode.\n\n__Example:__\n```php\n$response = $client-\u003elookup(array('postcode' =\u003e 'CF10 1DD'));\n```\n\n\nbulkLookup()\n--------\n[API documentation](https://postcodes.io/docs#Bulk-Postcode-Lookup)\n\nLookup data about a set of postcodes.\n\n__Parameters:__\n* `postcodes` _(Required)_: An array of postcodes (max 100).\n\n__Example:__\n```php\n$response = $client-\u003ebulkLookup(array('postcodes' =\u003e array('CF10 1DD', 'W1B 4BD')));\n```\n\n\nreverseGeocode()\n--------\n[API documentation](https://postcodes.io/docs#Geocode-Postcode)\n\nGet data for postcodes nearest a given latitude/longitude coordinate.\n\n__Parameters:__\n* `latitude` _(Required)_: The latitude.\n* `longitude` _(Required)_: The longitude.\n* `limit` _(Optional)_: The maximum number of postcodes to return (default 10, max 100).\n* `radius` _(Optional)_: The radius in metres in which to find postcodes (default 100, max 1000).\n\n__Example:__\n```php\n$response = $client-\u003ereverseGeocode(array('latitude' =\u003e 51.481667, 'longitude' =\u003e -3.182155));\n```\n\n\nbulkReverseGeocode()\n--------\n[API documentation](https://postcodes.io/docs#Geocode-Postcode)\n\nBulk translation of latitude/longitude coordinates into postcode data.\n\n__Parameters:__\n* `geolocations` _(Required)_: The geolocations to look up (maximum 100).  This parameter should be an array, each element with the following keys:\n\n    * `latitude` _(Required)_: The latitude.\n    * `longitude` _(Required)_: The longitude.\n    * `limit` _(Optional)_: The maximum number of postcodes to return (default 10, max 100).\n    * `radius` _(Optional)_: The radius in metres in which to find postcodes (default 100, max 1000).\n\n__Example:__\n```php\n$response = $client-\u003ebulkReverseGeocode(\n    array(\n        'geolocations' =\u003e array(\n            array('latitude' =\u003e 51.481667, 'longitude' =\u003e -3.182155),\n            array('latitude' =\u003e 51.88328, 'longitude' =\u003e -3.43684, 'limit' =\u003e 5, 'radius' =\u003e 500)\n        )\n    )\n);\n```\n\n\nmatching()\n--------\n[API documentation](https://postcodes.io/docs#Postcode-Query)\n\nFind postcodes matching a given query.\n\n__Parameters:__\n* `query` _(Optional)_: The postcode query, e.g. 'CF10'.\n* `limit` _(Optional)_: The maximum number of postcodes to return (default 10, max 100).\n\n__Example:__\n```php\n$response = $client-\u003ematching(array('query' =\u003e 'CF10', 'limit' =\u003e 20));\n```\n\n\nvalidate()\n--------\n[API documentation](https://postcodes.io/docs#Postcode-Validation)\n\nValidate a postcode.\n\n__Parameters:__\n* `postcode` _(Required)_: The postcode to validate.\n\n__Example:__\n```php\n$response = $client-\u003evalidate(array('postcode' =\u003e 'CF10 1DD'));\n```\n\n\nautocomplete()\n--------\n[API documentation](https://postcodes.io/docs#Postcode-Autocomplete)\n\nGet a list of postcodes to autocomplete a partial postcode.\n\n__Parameters:__\n* `postcode` _(Required)_: The postcode to autocomplete.\n* `limit` _(Optional)_: The maximum number of postcodes to return (default 10, max 100).\n\n__Example:__\n```php\n$response = $client-\u003eautocomplete(array('postcode' =\u003e 'CF10', 'limit' =\u003e 20));\n```\n\n\nrandom()\n--------\n[API documentation](https://postcodes.io/docs#Random-Postcode)\n\nGet data for a random postcode.\n\n__Parameters:__\nNone.\n\n__Example:__\n```php\n$response = $client-\u003erandom();\n```\n\n\noutwardCodeLookup()\n--------\n[API documentation](https://postcodes.io/docs#Show-Outcode)\n\nGet data for the specified \"outward code\" (first half of postcode).\n\n__Parameters:__\n* `outcode` _(Required)_: The outward code (first half of postcode) to get location data for.\n\n__Example:__\n```php\n$response = $client-\u003eoutwardCodeLookup(array('outcode' =\u003e 'CF10'));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxuk%2Fpostcodes-io-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxuk%2Fpostcodes-io-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxuk%2Fpostcodes-io-bundle/lists"}