live-controls / autoaddress
该软件包最新版本(v1.1.4)没有提供许可证信息。
自动填充地址表单
v1.1.4
2024-08-29 12:21 UTC
Requires
- guzzlehttp/guzzle: ^7.8
- live-controls/utils: ^1.0
- livewire/livewire: >=2.12
Requires (Dev)
README
输入地址,根据不同的API获取道路等信息的输入
需求
- Laravel 9+
- Livewire 2+
翻译
- 英语(en)
- 德语(de)
- 巴西葡萄牙语(pt_BR)
安装
- 安装 AutoAddress 软件包
composer require live-controls/autoaddress
内容
待办事项
用法
- 添加 CEPABERTO_TOKEN 和/或 ZIPCODEBASE_TOKEN 环境变量
- 如果您愿意,可以发布配置文件并更改那里的变量
- 基本用法
$cep = 01000001; $response = new \LiveControls\AutoAddress\Objects\CepAbertoResponse($cep); //or $cep = "01000-001"; //Can be a string as well, the CepAberto::fromCep() method will remove everything but numbers $response = new \LiveControls\AutoAddress\Objects\CepAbertoResponse($cep);
$response 对象包含以下变量
- $status => 响应状态,也可以通过 $response->isValid() 进行测试
- $cep => 地址的 CEP,这与发送到服务器的 $cep 相同
- $ibge => 地址的 IBGE
- $ddd => 地址的电话 DDD
- $street => 地址的街道
- $complement => 地址的补充信息
- $area => 地址的区域
- $city => 地址的城市
- $state => 地址的州
- $country => 地址的国家(如果为 CepAberto 则始终为巴西)
- $longitude => 地址的经度(可能为空!)
- $latitude => 地址的纬度(可能为空!)
- $altitude => 地址的海拔(可能为空!)
- 如果环境变量不起作用,请尝试发布配置文件,这可能在将来得到修复。