jflight / nearby-uk-postcode-finder
此包最新版本(0.0.2)没有提供许可证信息。
查找特定半径范围内的所有英国邮政编码
0.0.2
2014-07-26 09:29 UTC
Requires
- league/geotools: @stable
Requires (Dev)
- behat/behat: 2.4.*@stable
- phpunit/phpunit: 4.1.*
This package is not auto-updated.
Last update: 2024-09-24 03:02:56 UTC
README
邮政编码查找器接受一个英国邮政编码外码(空格之前的部分)和一个半径,并返回该半径范围内的所有其他英国邮政编码。
该工具使用一个包含邮政编码及其经纬度坐标的csv文件作为数据源,不应在生产环境中使用,尤其是在速度要求较高的环境中。项目使用了优秀的Geotools库。
安装
添加到 composer.json
"require": { "jflight/nearby-uk-postcode-finder": "dev-master" }
运行
composer update
使用方法
创建邮政编码
$postcode = new Jflight\PostcodeFinder\UkPostcode('CF11');
获取10公里范围内的所有邮政编码
$nearbyPostcodes = $postcode->findNearestPostcodes(10)); // Array of postcodes
扩展
理论上,邮编类可以被扩展并用于任何地区的邮政编码(或等效),只要提供包含经纬度的邮编csv查找。
这可以通过以下方式实现
<?php class NewPostcode extends Jflight\PostcodeFinder\Postcode { protected $file = "/path/to/csv.csv"; }