Code Monkey home page Code Monkey logo

dhl-express-rest's Introduction

Very short description of the package

Latest Version on Packagist

Package to work with the DHL Express Rest API (v2). This package is currently in development.

Installation

You can install the package via composer:

composer require kawashita86/dhl-express-rest

Usage

Domestic Shipments

$dto = new ShipmentCreator();
$dto->setShipperAccountNumber(954103895);
$dto->setShipper(
    (new CustomerDetails('John Smith','21 Apple Drive','Malmesbury','Wiltshire',
        'Malmesbury','SN16 4TB','GB','My Awesome Company','071111111112','[email protected]',
    ))
        ->addVat('GB1234')
        ->addEORI('GB1234')
);
$dto->setProductCode('N'); // GB
$dto->setReceiver(new Address('Helen Jones', '4 Drive', 'London', 'E14 8DW', 'GB'));
$dto->addReference('123456-custom-ref');
$dto->addPackage(new Package(12.5, 20, 10, 10, 'Jumpers', 'order-ref-1244'));

$dhl = DHL::make([
    'user' => 'DHLUSER',
    'pass' => 'dsdfsedf',
    'sandbox' => true, // false or remove for production
]);

$res = $dhl->shipments()->create($dto);
$res->trackingUrl; // tracking number
$res->trackingNumber; // url for api tracking
$res->labelData(); // decoded label data

Customs Declarable Shipments

Additional details needed

Note: setting the DDP account number, automatically sets the shipment up for DDP (delivery duty paid). Leave this blank/null to send DAP.

$dto->setCustomsDeclarable($declerable = true, $paperless = true, $ddpAccountNumber = 12345678);
$dto->setInvoice('PS-1234', now(), 'Adam Lambert');
$dto->setExportDeclaration('sale', 'GBP');
$dto->addExportLineItem(new LineItem('Red Jumper', 12.99, 1, 12456, 'GB', 12));
$dto->addExportLineItem(new LineItem('Blue Jumper', 12.99, 1, 12456, 'GB', 12));

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Other Resources

Postman Collection

Brexit Export Guide

Supermodel Docs

dhl-express-rest's People

Contributors

booni3 avatar

Watchers

 avatar

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.