2017 © Pedro Peláez
 

package postnl-ecs

Afosto PostNL ECS Client

image

afosto/postnl-ecs

Afosto PostNL ECS Client

  • Monday, June 19, 2017
  • by afosto
  • Repository
  • 0 Watchers
  • 0 Stars
  • 291 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 18 Versions
  • 24 % Grown

The README.md

PostNL ECS

Use this client to convieniently interact with PostNL ECS . This PHP package was developed by Afosto to make a reliable connection between Afosto (Retail Software) and PostNL ECS and provides the following functionality:, (*1)

  • send product information to ECS
  • send order information to ECS
  • receive stock information (mutations or full list)
  • receive shipment updates (track&trace codes)

Getting Started

Simply follow the installation instructions. You will need an account at PostNL ECS that is set up for you to use., (*2)

Prerequisites

What things you need to install the software and how to install them - PHP5.5+ - Composer (for installation), (*3)

Installing

Installing is easy through Composer., (*4)

composer require afosto/ecs

Examples

Now, to insert a product at ECS, use the following code., (*5)

First set some configuration parameters:, (*6)

$config = [
    'host'       => 'sftp-postnlint-accp.xs4.mendix.net',
    'port'       => 22,
    'username'   => '',
    'privateKey' => '',
    'root'       => '/home/{username}/' 
];

Initialze the application with the configuration, (*7)

App::init($config);

Send a product

Build the product object, (*8)

$product = new Product();
$product->sku = 'ART-1-TEST';
$product->shortDescription = 'Test article';
$product->ean = '1000000000016';
$product->height = $product->weight = $product->depth = $product->width = 1;

Make a message container and insert a message number (in this case 1) and add the product and send the message:, (*9)

$message = new ProductMessage(1);

Insert a single product or add multiple:, (*10)

$message->addMessagePart($product);
$message->addMessagePart([$product2, $product3]);

Now send the message:, (*11)

$message->send();

For debugging you can also download or show the XML file:, (*12)

$message->show();
$message->download();

Now the product should be available in ECS., (*13)

Stock updates

To parse a batch of stock messages, use the following code., (*14)

$stockListUpdates = new StockList();

Load the messages (XML files from the SFTP server):, (*15)

foreach ($stockListUpdates->getUpdates() as $model) {
    //Do something with the message
    $message = [
        'sku'   => $model->sku, 
        'count' => $model->count,
    ];
}

Mark the processed messages as read (they will be deleted):, (*16)

$stockListUpdates->markAsRead();

Other examples

In the examples directory you will find more examples of this project., (*17)

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository., (*18)

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details, (*19)

The Versions

19/06 2017

dev-master

9999999-dev https://afosto.com

Afosto PostNL ECS Client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client ecs postnl

19/06 2017
24/05 2017
23/05 2017

dev-feature/mailbox-methods

dev-feature/mailbox-methods https://afosto.com

Afosto PostNL ECS Client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client ecs postnl

13/04 2017
27/03 2017
27/03 2017

dev-hotfix/descriptions

dev-hotfix/descriptions https://afosto.com

Afosto PostNL ECS Client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client ecs postnl

23/03 2017
21/03 2017
09/03 2017
07/03 2017
28/02 2017
23/02 2017
23/02 2017
21/02 2017
20/02 2017
20/02 2017
20/02 2017