alecsanderabreu / correios-php
轻松与主要邮政功能交互的一种方式。
v2.3.6
2020-05-22 11:51 UTC
Requires
- php: ~5.6|~7.0
- guzzlehttp/guzzle: ~6.2
Requires (Dev)
- codeclimate/php-test-reporter: ~0.3
- phpunit/phpunit: ~5.0
- squizlabs/php_codesniffer: ~2.3
README
轻松与邮政的主要功能交互的一种方式。
功能
安装
通过Composer
$ composer require alecsanderabreu/correios-php
使用
查询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)。请参阅许可文件以获取更多信息。