/correios-php

Correios PHP SDK

Primary LanguagePHPMIT LicenseMIT

Correios PHP SDK

Latest Version on Packagist Software License Build Status StyleCI Coverage Status Quality Score Total Downloads

PHP SDK to interact with the Correios webservice.

Install

Via Composer

$ composer require flyingluscas/correios-php

Usage

use FlyingLuscas\Correios\Format;
use FlyingLuscas\Correios\Freight;
use FlyingLuscas\Correios\Service;

$freight = new Freight;

$freight->setServices(Service::SEDEX, Service::PAC);
$freight->setZipCodes('01001-000', '87047-230');
$freight->setFormat(Format::BOX);

$freight->cart->fill([
    [
        'width' => 16,
        'height' => 16,
        'length' => 16,
        'weight' => 0.3,
        'quantity' => 1,
    ],
    [
        'width' => 16,
        'height' => 16,
        'length' => 16,
        'weight' => 0.3,
        'quantity' => 3,
    ],
]);

$results = $freight->calculate();

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email lucas.pires.mattos@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.