arcreative/php-address-format
Composer 安装命令:
composer require arcreative/php-address-format
包简介
Simple address formatting for the masses
README 文档
README
Simple address formatting for the masses
Usage
$af = new AddressFormat(); $formattedAddress = $af->format(array( 'address' => '1234 Some St.', 'address2' => 'Floor #67', 'address3' => 'Unit #123', 'city' => 'San Francisco', 'subdivision' => 'CA', 'postalCode' => '94105', 'countryCode' => 'US' ));
will output
array( '1234 Some St.', 'Floor #67', 'Unit #123', 'San Francisco, CA 94105' )
If a line does not have any information, it will be omitted.
No fields are required to call the formatter, but the only property that will invoke some logic is the ISO 3166 Alpha-2 country code, for which an index can be found here.
Contributions
Gladly accepting contributions, hopefully in the form of additional countries. Regardless of current tests being a bit naive, please include tests for added countries to ensure the output is as expected.
Other implementations
- Node/JS - arcreative/node-address-format
统计信息
- 总下载量: 79.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-06-21