altrozero/postcode-uk
最新稳定版本:1.1
Composer 安装命令:
composer require altrozero/postcode-uk
包简介
UK Postcode helper function
README 文档
README
UK Postcode Helper
PHP Helper class for dealing with UK postcodes.
Used to break postcodes in to parts based on
https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Formatting
How to use
Break in to parts
<?php $postcode = new Postcode('SR5 1NA'); $postcode->get(); // SR51NA $postcode->getOutward(); //SR5 $postcode->getInward(); // 1NA $postcode->getArea(); // SR $postcode->getDistrict(); // 5 $postcode->getSector(); // 1 $postcode->getUnit(); // NA
Validate a postcode
<?php $good = Postcode::validate('SR5 1nA'); // true $bad = Postcode::validate('SR5 N1A'); // false
Format Postcodes in a consistent way
<?php $formatted = Postcode::format('Sr51NA'); // SR51NA $formatted = Postcode::format('sR5 1NA'); // SR51NA
Pull a postcode from an address string
<?php $postcode = Postcode::findInString('1 Fake Street, Fake Vil, Fake Country, SR51NA');
统计信息
- 总下载量: 45.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-04