jerfeson / correios
A library that facilitates integration with Brazilian postal services
1.0.0
2021-09-18 02:35 UTC
Requires
- ext-simplexml: *
- doctrine/annotations: ^1.13
- guzzlehttp/guzzle: ^7.3
- php-di/php-di: ^6.3
Requires (Dev)
- codeception/c3: ^2.0
- codeception/codeception: ^4.1
- codeception/module-asserts: ^1.0.0
- codeception/module-phpbrowser: ^1.0.0
- friendsofphp/php-cs-fixer: ^3.1
- overtrue/phplint: ^3.0
- phpstan/phpstan: ^0.12.99
This package is auto-updated.
Last update: 2024-11-20 23:02:34 UTC
README
This library facilitates the integration with the Correios delivery services of Brazil on php
Functionalities
Installation
- Using composer
$ composer require jerfeson/correios
How to use
Consult address by zip code
use Jerfeson\Correios; require 'vendor/autoload.php'; $correios = new Correios(); $repsonse = $correios->address()->find("73100‑020"); /** result [ 'zipcode' => '01001-000', 'street' => 'Praça da Sé', 'complement' => [ 'lado ímpar', ], 'district' => 'Sé', 'city' => 'São Paulo', 'uf' => 'SP', ] **/
Calculate Prices and Deadlines
Calculate prices and terms of delivery services (Sedex, PAC and etc), with support for multiple objects
in the same query.
use Jerfeson\Correios; require 'vendor/autoload.php'; $correios = new Correios(); $response = $correios->freight() ->origin('01001-000') ->destination('73100‑020') ->services(FreightType::SEDEX, FreightType::PAC) ->item(16, 16, 16, .3, 1)->calculate(); /** result [ 0 => [ 'name' => 'Sedex', 'code' => '4014', 'price' => 35.1, 'deadline' => 4, 'error' => [], ], 1 => [ 'name' => 'PAC', 'code' => '4510', 'price' => 24.8, 'deadline' => 8, 'error' =>[], ], ] */
How to test
$ composer test
Roadmap
- CodeCoverage
License
jerfeson/correios is release under the MIT license.
Thanks
This project is based on the project in flyingluscas/correios-php feel free to contribute to this and the other project.