2017 © Pedro Peláez
 

library sdk

This package is designed to send and receive data from MyParcel by means of an API.

image

myparcelbe/sdk

This package is designed to send and receive data from MyParcel by means of an API.

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 41 Versions
  • 0 % Grown

The README.md

MyParcel SDK



Please, star this repository if you use this repository. :star:, (*1)

Installation with composer

This SDK uses composer., (*2)

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you., (*3)

For more information on how to use/install composer, please visit: https://github.com/composer/composer, (*4)

To install the MyParcel SDK into your project, simply, (*5)

$ composer require myparcelbe/sdk

Installation without composer

If you don't have experience with composer, it is possible to use the SDK without using composer., (*6)

You can download the zip on the projects releases page., (*7)

  1. Download the package zip (SDKvx.x.x.zip).
  2. Unzip the contents of the zip, and upload the vendor directory to your server.
  3. In your project, require the file src/AutoLoader.php
  4. You can now use the SDK in your project

Requirements

The MyParcel SDK works on php versions 5.6, 7.x. Also the php curl extension needs to be installed., (*8)

Quick start and examples

$myParcelCollection = new \MyParcelBE\Sdk\src\Helper\MyParcelCollection();

$consignment = (new \MyParcelBE\Sdk\src\Model\Repository\MyParcelConsignmentRepository())
    ->setApiKey('api_key_from_MyParcel_backoffice')
    ->setReferenceId('Order 1203')
    ->setCountry('BE')
    ->setPerson('Piet Hier')
    ->setCompany('Piet BV')
    ->setFullStreet('Plein 1945 55b')
    ->setPostalCode('2231JE')
    ->setCity('Amsterdam')
    ->setEmail('test@test.nl');

$myParcelCollection
    ->addConsignment($consignment)
    ->setPdfOfLabels()
    ->downloadPdfOfLabels()
    ->setUserAgent('name_of_cms', '1.0');

Available Methods

$myParcelCollection = new \MyParcelBE\Sdk\src\Helper\MyParcelCollection();

$consignment = (new \MyParcelBE\Sdk\src\Model\Repository\MyParcelConsignmentRepository())
    ->setApiKey('api_key_from_MyParcel_backoffice')
    ->setReferenceId('Order 1203')
    ->setCountry('BE')
    ->setPerson('Piet Hier')
    ->setCompany('Piet BV')
    ->setFullStreet('Plein 1945 55b')
    ->setPostalCode('2231JE')
    ->setPackageType(1)
    ->setCity('Amsterdam')
    ->setEmail('test@test.nl')
    ->setPhone('+31 (0)634213465')
    ->setLargeFormat(true)
    ->setOnlyRecipient(true)
    ->setSignature(true)
    ->setReturn(true)
    ->setInsurance(250)
    ->setLabelDescription('Order 10034');

$myParcelCollection
    ->addConsignment($consignment)

User-agent

To give us insight into which CMS system you make a connection from, you should send a User-Agent. If you're using a known CMS system it's required. You must send the name of the CMS system followed by a version number. A version is not required., (*9)

    ->setUserAgent('name_of_cms', '1.0')

Submitting full address

    ->setFullStreet('Plein 1945 55b')

Submitting address in pieces

    ->setStreet('Plein 1945')
    ->setNumber((string)55)
    ->setBoxNumber('b')

Create concept

$myParcelCollection->createConcepts();

Download labels

$myParcelCollection->setPdfOfLabels();
$myParcelCollection->downloadPdfOfLabels();
$myParcelCollection
    ->setLinkOfLabels()
    ->getLinkOfLabels()

MyParcel consignment id

If you don't use setReferenceId(), you can also use the MyParcelConsignmentId when you create a concept: After setPdfOfLabels(), setLinkOfLabels() and createConcepts(), you can save the api id to your database. With this id you can easily retrieve the latest status., (*10)

$consignment->getMyParcelConsignmentId();

Get status

After setPdfOfLabels(), setLinkOfLabels() and createConcepts() you can get the status., (*11)

$status = $consignment->getStatus();

Get barcode

The barcode is available after setPdfOfLabels() and setLinkOfLabels(), (*12)

$barcode = $consignment->getBarcode();

Multiple shipments

To create multiple consignments or get one pdf with multiple consignments, set multiple consignments. It's faster and cleaner., (*13)

$myParcelCollection = new \MyParcelBE\Sdk\src\Helper\MyParcelCollection();

foreach ($yourShipments as $yourShipment) {

    $consignment = (new \MyParcelBE\Sdk\src\Model\Repository\MyParcelConsignmentRepository())
        ->setApiKey('api_key_from_MyParcel_backoffice')
        ->setReferenceId($yourShipment->getOrderId()
        ->setName('Piet Hier');
        /** @todo; set all info */

    $myParcelCollection
        ->setUserAgent('name_of_cms', '1.0')
        ->addConsignment($consignment)
}

Later on

In a new request, you can get all the data again., (*14)

$consignment = (new \MyParcelBE\Sdk\src\Model\Repository\MyParcelConsignmentRepository())
    ->setApiKey('api_key_from_MyParcel_backoffice')
    ->setReferenceId('Order 1203'); // or setMyParcelConsignmentId(123456)

$myParcelCollection
    ->addConsignment($consignment)
    ->setLatestData();

$consignments = $myParcelCollection
    ->getConsignments();

$firstConsignment = $consignments[0];

$status = $firstConsignment->getStatus();
$barcode = $firstConsignment->getBarcode();

Contribute

  1. Check for open issues or open a new issue to start a discussion around a bug or feature.
  2. Fork the repository on GitHub to start making your changes.
  3. Write one or more tests for the new feature or that expose the bug.
  4. Make code changes to implement the feature or fix the bug.
  5. Send a pull request to get your changes merged and published.

The Versions

10/07 2018

dev-master

9999999-dev https://www.sendmyparcel.be

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5

 

The Development Requires

15/06 2018

v1.3.9

1.3.9.0 https://www.sendmyparcel.be

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5

 

The Development Requires

15/06 2018

dev-develop

dev-develop https://www.sendmyparcel.be

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5

 

The Development Requires

13/06 2018

v1.3.8

1.3.8.0 https://www.sendmyparcel.be

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5

 

The Development Requires

02/03 2018

v1.3.7

1.3.7.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

13/02 2018

v1.3.6

1.3.6.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

08/02 2018

v1.3.5

1.3.5.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

07/02 2018

v1.3.4

1.3.4.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

19/01 2018

v1.3.3

1.3.3.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

21/12 2017

v1.3.2

1.3.2.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

20/12 2017

v1.3.1

1.3.1.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

26/10 2017

v1.3.0

1.3.0.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

26/10 2017

v1.2.4

1.2.4.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

24/10 2017

v1.2.3

1.2.3.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

29/09 2017

v1.2.2

1.2.2.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

26/09 2017

v1.2.1

1.2.1.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

20/09 2017

v1.2.0

1.2.0.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

31/08 2017

v1.2.0-beta.2

1.2.0.0-beta2 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

31/08 2017

v1.2.0-beta.1

1.2.0.0-beta1 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

31/08 2017

v1.1.10

1.1.10.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.2

 

The Development Requires

03/08 2017

v1.1.9

1.1.9.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

20/07 2017

v1.1.8

1.1.8.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

17/07 2017

v1.1.7

1.1.7.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

04/07 2017

v1.1.6

1.1.6.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

27/06 2017

v1.1.5

1.1.5.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

27/06 2017

v1.1.4

1.1.4.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

26/06 2017

v1.1.3

1.1.3.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

26/06 2017

v1.1.2

1.1.2.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

26/06 2017

v1.1.1

1.1.1.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

26/06 2017

v1.1.0

1.1.0.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

23/06 2017

v1.0.1

1.0.1.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

21/06 2017

v1.0.0

1.0.0.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

30/03 2017

v0.2.12

0.2.12.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

22/02 2017

v0.2.11

0.2.11.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

22/02 2017

v0.2.10

0.2.10.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

22/02 2017

v0.2.7

0.2.7.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php >=5.6.5 <7.1

 

The Development Requires

06/02 2017

v0.2.6

0.2.6.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php ~5.6.5

 

The Development Requires

27/01 2017

v0.2.4

0.2.4.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php ~5.6.5

 

The Development Requires

26/01 2017

v0.2.3

0.2.3.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php ~5.6.5

 

The Development Requires

22/01 2017

0.2.2

0.2.2.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Requires

  • php ~5.6.5

 

The Development Requires

22/08 2016

0.1.0

0.1.0.0 https://www.myparcel.nl

This package is designed to send and receive data from MyParcel by means of an API.

  Sources   Download

CC BY-NC-ND 3.0 NL

The Development Requires