PHP code example of kaiorocha / frenet

1. Go to this page and download the library: Download kaiorocha/frenet library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kaiorocha / frenet example snippets


//Configure as informações do cadastro
$config = Frenet::init([
            'service' => 'logistics',
            'method' => 'ShippingQuoteWS',
            'Username' => '',
            'Password' => '',
            'SellerCEP' => '04542051',
        ]);
        
//Instancia o serviço Shipping
$test = new \Shipping\Shipping();

//Chama o método getShippingQuote passando as configurações definidas como primeiro parametro e um array contendo, Itens(Array), CEP(String) e TOTAL(Float) do carrinho como segundo parâmetro.
print_r($test::getShippingQuote($config, [
    'itens' => [
        [
            'weight' => 1,
            'length' => 1,
            'height' => 1,
            'width' => 1,
            'diameter' => 0,
            'sku' => 'SKU-001',
            'category' => 'Tests',
            'isFragile' => false,
        ]
    ],
    'cep' => '07716135',
    'total' => 109.90
]));