{"id":15046091,"url":"https://github.com/adamlc/address-format","last_synced_at":"2025-10-19T18:22:31.872Z","repository":{"id":10098117,"uuid":"12160067","full_name":"adamlc/address-format","owner":"adamlc","description":"A PHP library to parse street addresses to localized formats","archived":false,"fork":false,"pushed_at":"2025-02-04T09:00:03.000Z","size":168,"stargazers_count":84,"open_issues_count":0,"forks_count":23,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-09T13:52:37.285Z","etag":null,"topics":["composer","formatter","php","php-library","street-address"],"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/adamlc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-08-16T14:14:12.000Z","updated_at":"2025-05-06T18:54:08.000Z","dependencies_parsed_at":"2024-06-18T17:02:03.557Z","dependency_job_id":"790e9f33-9169-40a5-9bcb-1c076d769a68","html_url":"https://github.com/adamlc/address-format","commit_stats":{"total_commits":40,"total_committers":11,"mean_commits":"3.6363636363636362","dds":0.6,"last_synced_commit":"22b08024a77b5d9ac0a1c8addc652befe9283c68"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamlc%2Faddress-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamlc%2Faddress-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamlc%2Faddress-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamlc%2Faddress-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamlc","download_url":"https://codeload.github.com/adamlc/address-format/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485060,"owners_count":22078767,"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":["composer","formatter","php","php-library","street-address"],"created_at":"2024-09-24T20:52:41.705Z","updated_at":"2025-10-19T18:22:31.819Z","avatar_url":"https://github.com/adamlc.png","language":"PHP","readme":"Address Format\n=============\n\n[![Latest Version](https://img.shields.io/github/tag/adamlc/address-format.svg?label=release\u0026style=flat-square)](https://github.com/adamlc/address-format/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/adamlc/address-format/ci.yml?style=flat-square)](https://github.com/adamlc/address-format/actions/workflows/ci.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/adamlc/address-format.svg?style=flat-square)](https://packagist.org/packages/adamlc/address-format)\n\nA PHP library to parse street addresses to localized formats. The address formats are based on the formats supplied by Google's libaddressinput.\n\nI have written a few basic unit tests, but they could probably be improved. Feel free to submit a pull request if you improve them!\n\n\n## Composer\n\nTo install AddressFormat as a Composer package add this to your composer.json:\n\n```json\n\"adamlc/address-format\": \"~1.3\"\n```\n\nRun `composer update`\n\n\n## Formatting a Street Address\n\n```php\n//Create an address formatter instance\n$address_formatter = new Adamlc\\AddressFormat\\Format;\n\n//Set a locale using a two digit ISO country code.\n$address_formatter-\u003esetLocale('GB');\n\n//Set the address parts / attributes\n$address_formatter['ADMIN_AREA'] = 'London';\n$address_formatter['LOCALITY'] = 'Greenwich';\n$address_formatter['RECIPIENT'] = 'Joe Bloggs';\n$address_formatter['ORGANIZATION'] = 'Novotel London';\n$address_formatter['POSTAL_CODE'] = 'SE10 8JA';\n$address_formatter['STREET_ADDRESS'] = '173-185 Greenwich High Road';\n$address_formatter['COUNTRY'] = 'United Kingdom';\n\n//Get the address in localised format\n$html = true; // Optional - return the address in HTML \u003cbr\u003e instead of \\n new lines\n\necho $address_formatter-\u003eformatAddress($html);\n```\n\n\nThe above code will produce the following:\n\n```\nJoe Bloggs\nNovotel London\n173-185 Greenwich High Road\nGreenwich\nLondon\nSE10 8JA\n```\n\n\nNote: Look in the i18n directory to view the meta data for the locales.\n\n\nThe following attributes are available:\n\nADMIN_AREA  \nLOCALITY  \nRECIPIENT  \nORGANIZATION  \nDEPENDENT_LOCALITY  \nPOSTAL_CODE  \nSORTING_CODE  \nSTREET_ADDRESS  \nCOUNTRY  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamlc%2Faddress-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamlc%2Faddress-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamlc%2Faddress-format/lists"}