PHP code example of leroy-merlin-br / laravel-axado-api

1. Go to this page and download the library: Download leroy-merlin-br/laravel-axado-api 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/ */

    

leroy-merlin-br / laravel-axado-api example snippets


class Product implements Axado\Volume\VolumeInterface {
    use Axado\Volume\VolumeTrait;

    public function getSku()       { return "123"; }
    public function getQuantity()  { return 10; }
    public function getPriceUnit() { return 10.5; }
    public function getHeight()    { return 10; }
    public function getLength()    { return 10; }
    public function getWidth()     { return 10; }
    public function getWeight()    { return 10; }
}

    \Axado\Shipping::$token = "your-token";
    

    $shipping = new Axado\Shipping();
    
    $shipping->setPostalCodeOrigin('04661100');
    $shipping->setPostalCodeDestination('13301430');
    $shipping->setTotalPrice('40');
    $shipping->setAdditionalDays('10');
    $shipping->setAdditionalPrice('12.6');
    

    $volume = new Product();
    $shipping->addVolume($volume);
    

    $shipping->quotations();
    

    $shipping->getCosts();      // in reais
    $shipping->getDeadline();   // in days