Giter Site home page Giter Site logo

shipping's Introduction

Shipping

Generate PDF Label for Chronpost or Colissimo, get only the pdf to print and the tracking number

#Install with composer :

composer require tlissak/shipping

Colissimo usage :

use Shipping\Colissimo ;

$colissimo = new Colissimo('accountNumber','accountPassword') ;

$payloads = [
    'label'=>'CMD0001',
    'weight'=>1,
    'date'=>date('Y-m-d'),
    'shipper'=>[
        'companyName' => 'Your Company Name',
        'line2'       => '10 Postal Address',
        'countryCode' => 'FR',
        'city'        => 'PARIS',
        'zipCode'     => '75000',
        'email'       => '' //[email protected]
    ]
    ,'recipient'=>[
        'companyName' => 'recipient Company',
        'lastName'      => 'recipient Last name', //
        'firstName'     => 'recipient First name', //
        'line2'       => 'recipient Postal address' ,// Address
        'line3'       => '', //Additional Information
        'countryCode' => 'FR', //
        'city'        => 'PARIS', //
        'zipCode'     => '75000', //
        'phone'=>'0600000000', // 10 digits 
         'email'=>'', //recipient address
    ]
] ;


$response = $colissimo->generateLabel($payloads);
echo $response['tracking'] ; 
file_put_contents("colissimo.pdf",$response["pdf"]) ;

For Chronopost :

use Shipping\Chronopost ;

$payloads = [

    'shipper' => [
        'Adress1'=>'Your postal address'
        ,'Adress2'=>''
        ,'City'=>'Paris'
        ,'Civility'=>'M'
        ,'ContactName'=>'Your contact name' //Company
        ,'Country'=>'FR'
        ,'CountryName'=>'FRANCE'
        ,'Email'=>'[email protected]'
        ,'MobilePhone'=>''
        ,'Name'=>'Your name' //Company
        ,'Name2'=>''
        ,'Phone'=>'0600000000' // 10 digits
        ,'PreAlert'=>'0'
        ,'ZipCode'=>'75000'
    ]
    ,'customer'=>[
        'Adress1'=>'Your recepient postal address'
        ,'Adress2'=>''
        ,'City'=>'PARIS'
        ,'Civility'=>'M'
        ,'ContactName'=>'Contact Name'//Lissak
        ,'Country'=>'FR'
        ,'CountryName'=>'FRANCE'
        ,'Email'=>'[email protected]' //
        ,'MobilePhone'=>'0600000000' // 10 digits
        ,'Name'=>'First name'
        ,'Name2'=>'Last Name'
        ,'Phone'=>''
        ,'PreAlert'=>'1'
        ,'ZipCode'=>'75000'
    ]
    ,'recipient'=>[]
    ,'ref'=>[
        'shipperRef'=>'BC0000000000001'
    ]
    ,'skybill'=>[
        'productCode'=>'01' // For Chrono relay 13H use 86
        ,'shipDate'=>date('c')
        ,'shipHour'=>date('G')
        ,'weight'=>1 //KGM
        ,'service' => '0'
        ,'objectType'=>'MAR' //DOC / MAR Document ou Marchandise
        
    ]
] ;
$payloads['recipient'] = $payloads['customer'];

$chronopost = new Chronopost('TODO','TODO');


try {
    $result = $chronopost->genereEtiquette($payloads);
} catch (Exception $soapFault) {
    //var_dump($soapFault);
    exit($soapFault->faultstring);
}

if ($result->return->errorCode) {
    echo 'Erreur n° ' . $result->return->errorCode . ' : ' . $result->return->errorMessage;

} else {
    
    echo $result->return->skybillNumber ; 
file_put_contents("chronopost.pdf",$result->return->skybill) ;


}

shipping's People

Contributors

tlissak avatar woozyfr avatar

Forkers

alexspeedway

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.