newtz / zipcode
通过输入邮编查找全球地址
1.0.0
2020-05-25 00:28 UTC
Requires
- level-2/dice: ^4.0
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-09-28 12:26:29 UTC
README
您可以通过实例化搜索器来获取邮编信息。
🚀 开始使用
先决条件
composer
php 7.0 >=
🔃 安装
运行
composer require newtz/zipcode
之后,只需导入 ZipCode 类
use ZipCode\ZipCode;
✅ 使用方法
ZipCode::getSearcher()
需要一个国家缩写。如果没有传入,将搜索巴西。
$searcher= ZipCode::getSearcher('US');
$searcher->find('90210');
echo $searcher->address;
输出: Beverly Hills - California. 34.0901, -118.4065.
$searcher->address->street
- 仅对巴西搜索可用,否则为 null
$searcher->address->state
- 所有搜索中都可用
$searcher->address->city
- 所有搜索中都可用
$searcher->address->neighborhood
- 仅对巴西搜索可用,否则为 null
$searcher->address->latitude
- 仅对全球搜索可用,否则为 null
$searcher->address->longitude
- 仅对全球搜索可用,否则为 null
🤔 贡献
要开始...
步骤 1
- 🍴 分支此仓库!
步骤 2
- 👯 使用
https://github.com/Newtz/ZipCodeSearcher
将此仓库克隆到您的本地机器上
步骤 3
- 🎋 使用
git checkout -b my-feature
创建您的功能分支
步骤 4
- ✅ 使用
git commit -m 'feat: My new feature'
提交您的更改;
步骤 5
- 📌 使用
git push origin my-feature
推送到分支;
步骤 6
- 🔃 创建一个新的拉取请求
您的拉取请求合并后,您可以删除您的功能分支。
✅ 测试
要运行测试,请执行以下命令
./vendor/bin/phpunit --process-isolation
作者
许可证
本项目采用 MIT 许可证