Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

magedin/econocargo-php

Repository files navigation

econoCARGO PHP SDK

About

This is the official SDK (Software Development Kit) for econoCARGO API. This SDK is intended to help with PHP systems and econoCARGO API.

Installing

Installing with composer

To install using composer you'll need to have composer installed on your computer so you will be able to install this SDK into your project easily.

Once you have composer installed you just need to require this SDK:

> composer require magedin/econocargo-php

Usage

To start using this SDK into your PHP system is really simple. Take a look in the example right below on how it's really easy to use:

config()->service()->isTesting(true); $quote = $api->shipping()->quote(); $quote->setCompanyCNPJ('05663266000219') ->setOrderNumber('123456') ->setDestinyId('9836') ->setDestinyUFName('SP') ->setDestinyIBGECode(0) ->setDestinyPostcode('04100-000') ->setSegmentId(5) ->setDestinyCNPJ("12345678901234") ->setDestinyCPF("01234567890") ->setDimensionsTotalValue(0.9) ->setWeightTotalValue(150) ->setInvoiceTotalValue(1500) ->setCheaperQuote(true) ->setResponseQuoteType(QuoteResponseType::TYPE_ALL) ; $result = $quote->execute(); $shippingServices = $result->getShippingServices(); } catch (\Exception $e) { echo "Some error has happened."; }">

use EconoCargo\ApiFactory;
use EconoCargo\Options\Request\QuoteResponseType;

/**
* Require composer autoload file.
*/
require_once __DIR__ . '/../vendor/autoload.php';

try {
$api = ApiFactory::create();

/** Activating testing mode (API Sandbox). */
$api->config()->service()->isTesting(true);
$quote = $api->shipping()->quote();
$quote->setCompanyCNPJ('05663266000219')
->setOrderNumber('123456')
->setDestinyId('9836')
->setDestinyUFName('SP')
->setDestinyIBGECode(0)
->setDestinyPostcode('04100-000')
->setSegmentId(5)
->setDestinyCNPJ("12345678901234")
->setDestinyCPF("01234567890")
->setDimensionsTotalValue(0.9)
->setWeightTotalValue(150)
->setInvoiceTotalValue(1500)
->setCheaperQuote(true)
->setResponseQuoteType(QuoteResponseType::TYPE_ALL)
;

$result = $quote->execute();

$shippingServices = $result->getShippingServices();
} catch (\Exception $e) {
echo "Some error has happened.";
}

About

This is the official SDK (Software Development Kit) for econoCARGO API. This SDK is intended to help with PHP systems and econoCARGO API.

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages