fhferreira / correios-php-fork
与主要邮政功能交互的一种简单方法。
v1.0
2021-01-14 16:55 UTC
Requires
- php: ~5.6|~7.0
- ext-soap: *
- guzzlehttp/guzzle: ~7.2|~6.5
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ~3.5
This package is auto-updated.
Last update: 2024-09-18 20:50:08 UTC
README
与Correios的主要功能交互的一种简单方法。
功能
安装
通过Composer
$ composer require fhferreira/correios-php-fork
使用
查询CEP
通过直接查询邮政的Web服务来查找通过CEP找到的地址。
use FlyingLuscas\Correios\Client; require 'vendor/autoload.php'; $correios = new Client; $correios->zipcode() ->find('01001-000'); /* Resultado: [ 'zipcode' => '01001-000', 'street' => 'Praça da Sé', 'complement' => [ 'lado ímpar', ], 'district' => 'Sé', 'city' => 'São Paulo', 'uf' => 'SP', ] */
计算价格和期限
使用多对象支持计算交付服务的价格和期限(如Sedex、PAC等)。
use FlyingLuscas\Correios\Client; use FlyingLuscas\Correios\Service; require 'vendor/autoload.php'; $correios = new Client; $correios->freight() ->origin('01001-000') ->destination('87047-230') ->services(Service::SEDEX, Service::PAC) ->item(16, 16, 16, .3, 1) // largura, altura, comprimento, peso e quantidade ->item(16, 16, 16, .3, 3) // largura, altura, comprimento, peso e quantidade ->item(16, 16, 16, .3, 2) // largura, altura, comprimento, peso e quantidade ->calculate(); /* Resultados: [ [ 'name' => 'Sedex', 'code' => 40010, 'price' => 51, 'deadline' => 4, 'error' => [], ], [ 'name' => 'PAC', 'code' => 41106, 'price' => 22.5, 'deadline' => 9, 'error' => [], ], ] */
变更日志
查看CHANGELOG以获取有关最近更改的更多信息。
测试
$ composer test
贡献
查看CONTRIBUTING以获取更多详细信息。
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件向 lucas.pires.mattos@gmail.com 发送,而不是使用问题跟踪器。
致谢
许可证
MIT许可证(MIT)。请参阅许可证文件以获取更多信息。