dafiti/correios

PHP integration with Correios Webservice

0.1.1 2016-06-30 12:23 UTC

This package is not auto-updated.

Last update: 2021-06-11 23:35:18 UTC


README

Build Status Scrutinizer Code Quality Code Coverage HHVM Latest Stable Version Total Downloads License

PHP integration with Correios API

Correios integration, using the following implementation manual.

Methods implemeted until now are:

  • solicitarRange
  • solicitarPostagemReversa

Instalation

The package is available on Packagist. Autoloading is PSR-4 compatible.

{
    "require": {
        "dafiti/correios": "dev-master"
    }
}

Usage

To use any method you need the following information first, which are required for most of the API calls:

  • usuario
  • senha
  • codAdministrativo
  • contrato

To make an API call is quite simple, all you have to do use the client method with the default configuration file and the information needed to consume it:

<?php
namespace Dafiti\Correios\Service;

use Dafiti\Correios\Entity;

class ClientTest extends \PHPUnit_Framework_TestCase
{
    private $client;

    public function setUp()
    {
        $this->client = new Client(
            new Entity\Config([
                'wsdl' => 'http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol?wsdl',
                'usuario' => '60618043',
                'senha' => '8o8otn',
                'codAdministrativo' => '08082650',
                'contrato' => '9912208555',
            ])
        );
    }
    public function testSolicitarRange()
    {
        $this->client->solicitarRange('AP', '', 1);
    }
}

You can find example for all methods available inside the tests/integration folder.

License

MIT License