PHPackages                             pedroquezado/braspress - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pedroquezado/braspress

ActiveLibrary

pedroquezado/braspress
======================

API Client para integração com a Braspress.

1.0(1y ago)011MITPHPPHP ^7.4 || ^8.0

Since Aug 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/pedroquezado/braspress)[ Packagist](https://packagist.org/packages/pedroquezado/braspress)[ RSS](/packages/pedroquezado-braspress/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Braspress PHP Client
====================

[](#braspress-php-client)

[![Maintainer](https://camo.githubusercontent.com/0a080976a7491620e4b9edfc914dd655ac5dd452570d344c0980aff4e8f99428/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6d61696e7461696e65722d40706564726f7175657a61646f2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/pedroquezado)[![Source Code](https://camo.githubusercontent.com/d5cbd7e600c0a2af675931116a05a65dda391b118d3f21c8a91337a00750e2f2/687474703a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d706564726f7175657a61646f2f6272617370726573732d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/pedroquezado/braspress)[![PHP from Packagist](https://camo.githubusercontent.com/9cdd11670cb185062a144d2236ece8b7f1dbe07a750a64ef8337ec0dc214f41f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f706564726f7175657a61646f2f6272617370726573732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pedroquezado/braspress)[![Latest Version](https://camo.githubusercontent.com/f5ea7281369722c6fee865376ee0338b07c9b6b1ebe55f3ef38a90cd99415080/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f706564726f7175657a61646f2f6272617370726573732e7376673f7374796c653d666c61742d737175617265)](https://github.com/pedroquezado/braspress/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build](https://camo.githubusercontent.com/dbf01dec037c6a4805a346da24b3c217001c813caa20aef86220288a26b4bc4a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f706564726f7175657a61646f2f6272617370726573732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pedroquezado/braspress)[![Quality Score](https://camo.githubusercontent.com/6047fb0c7b0a6b04424c372778531d6160023f8127ede2773fe4c1c6004b8c58/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f706564726f7175657a61646f2f6272617370726573732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pedroquezado/braspress)[![Total Downloads](https://camo.githubusercontent.com/24cf234abca228c33f6aad7159623ace0f0502fa1eb8ea789da5148f17b2208b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706564726f7175657a61646f2f6272617370726573732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pedroquezado/braspress)

This PHP client library allows you to interact with the Braspress API for freight quotation and tracking services. The library provides a convenient way to access Braspress's services, including calculating shipping costs and tracking shipments, with support for both rodoviário (road) and aéreo (air) modalities.

Installation
------------

[](#installation)

To install this library, you can use Composer:

```
composer require pedroquezado/braspress
```

Usage
-----

[](#usage)

### Initialization

[](#initialization)

To start using the Braspress client, first, initialize the `BraspressCliente` class with your credentials.

```
require 'vendor/autoload.php';

use PedroQuezado\Code\Braspress\BraspressCliente;

$cliente = new BraspressCliente('your_braspress_username', 'your_braspress_password');
```

### Adding Products

[](#adding-products)

Before performing a freight quotation, you need to add products (volumes) to the client:

```
$cliente->inserirProduto(5.5, [
    'comprimento' => 0.67,
    'largura' => 0.67,
    'altura' => 0.46
]);

$cliente->inserirProduto(2.3, [
    'comprimento' => 0.45,
    'largura' => 0.30,
    'altura' => 0.20
]);
```

Each call to `inserirProduto` adds a new volume to the list of products to be included in the freight quotation.

### Performing Freight Quotation

[](#performing-freight-quotation)

You can perform a freight quotation for either or both modalities (road and air):

```
try {
    $dadosCotacao = [
        'cnpjRemetente' => '12345678000100',
        'cnpjDestinatario' => '09876543210001',
        'tipoFrete' => '1', // 1 for CIF, 2 for FOB
        'cepOrigem' => '12345000',
        'cepDestino' => '54321000',
        'vlrMercadoria' => 500.00
    ];

    $resultados = $cliente->realizarCotacao($dadosCotacao, 'json', ['R', 'A']);

    print_r($resultados);
} catch (\PedroQuezado\Code\Braspress\BraspressClienteException $e) {
    echo 'Erro: ' . $e->getMessage();
}
```

The `realizarCotacao` method performs the freight quotation for the specified modality (`R` for road, `A` for air, or both). The results are returned as an associative array, separated by modality.

### Example Response

[](#example-response)

```
Array
(
    [Rodoviario] => Array
        (
            [id] => 274407950
            [prazo] => 5
            [totalFrete] => 73.02
        )

    [Aereo] => Array
        (
            [id] => 274408248
            [prazo] => 2
            [totalFrete] => 631.38
        )
)
```

### Error Handling

[](#error-handling)

Errors are handled via exceptions. If an error occurs during the API request, a `BraspressClienteException` is thrown:

```
try {
    // API call
} catch (\PedroQuezado\Code\Braspress\BraspressClienteException $e) {
    echo "Erro: " . $e->getMessage();
}
```

Advanced Features
-----------------

[](#advanced-features)

### Setting Modalities

[](#setting-modalities)

You can set the freight modalities when calling the `realizarCotacao` method. Pass an array with `'R'` and/or `'A'` to get quotes for road and/or air modalities.

### Handling Responses

[](#handling-responses)

The `realizarCotacao` method returns the result as an associative array. The keys `Rodoviario` and `Aereo` contain the corresponding results.

Documentation
-------------

[](#documentation)

For more information, please refer to the official Braspress API documentation:

- [Braspress API Documentation](https://api.braspress.com/home)

License
-------

[](#license)

This library is open-source and available under the MIT license. See the LICENSE file for more information.

Contributions
-------------

[](#contributions)

Contributions are welcome! Please submit a pull request or open an issue to contribute to this project.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

635d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/488263a0539dc2516233e307ccf5da7f45694bde3a5535e4d1954ea4bc94026c?d=identicon)[pedroquezado](/maintainers/pedroquezado)

---

Top Contributors

[![pedroquezado](https://avatars.githubusercontent.com/u/8839458?v=4)](https://github.com/pedroquezado "pedroquezado (1 commits)")

### Embed Badge

![Health badge](/badges/pedroquezado-braspress/health.svg)

```
[![Health](https://phpackages.com/badges/pedroquezado-braspress/health.svg)](https://phpackages.com/packages/pedroquezado-braspress)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
