An open API service indexing awesome lists of open source software.

https://github.com/magedin/econocargo-php

This is the official SDK (Software Development Kit) for econoCARGO API. This SDK is intended to help with PHP systems and econoCARGO API.
https://github.com/magedin/econocargo-php

composer development-kit econocargo-api econocargo-php frete integration php php7 sdk sdk-php shipping shipping-api shipping-rates

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

          

# econoCARGO PHP SDK

[![Build Status](https://travis-ci.com/magedin/econocargo-php.svg?branch=main)](https://travis-ci.com/magedin/econocargo-php)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/bdeae8b97e744a6aa09b8faf7d7b24dd)](https://www.codacy.com/gh/magedin/econocargo-php/dashboard?utm_source=github.com&utm_medium=referral&utm_content=magedin/econocargo-php&utm_campaign=Badge_Grade)

### 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:

```bash
> 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:

```php
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.";
}
```