2017 © Pedro Peláez
 

library phpdivideiq

PHP connector library for Divide IQ

image

dividebv/phpdivideiq

PHP connector library for Divide IQ

  • Tuesday, May 30, 2017
  • by ameenross
  • Repository
  • 2 Watchers
  • 1 Stars
  • 155 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

PHPDivideIQ

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

A PHP library to connect to Divide.IQ., (*2)

Installation

Composer

composer require dividebv/phpdivideiq, (*3)

Example Usage

use DivideBV\PHPDivideIQ\DivideIQ;

$username = 'user';          // You will receive this from the provider.
$password = 'password';      // You will receive this from the provider.
$environment = 'production'; // May also be `staging` or an arbitrary URL.

// A file storing the connection status.
$file = new SplFileObject('persist.iq.txt', 'c+');

if ($file->getSize()) {
    // The file already exists, instantiate DivideIQ using the file.
    $divideIq = DivideIQ::fromFile($file);
} else {
    // File doesn't exist. Instantiate DivideIQ using the constructor.
    $divideIq = new DivideIQ($username, $password, $environment);
    $divideIq->setFile($file);
}

// Access a resource provided by this Divide.IQ server.
$result = $divideIq->request('stockbase_stock');

Debugging

If you implemented this library like the example above, then the first step in debugging would be to remove the persist.iq.txt file. It's a JSON file with connection credentials. Removing it will force the library to start afresh by logging in with your username and password., (*4)

Note: this only helps when the connection previously worked., (*5)

OrderRequest

$this->result = $this->divideIq->request('stockbase_orderrequest', $this->payload, 'POST');

$this->payload = array(
                'OrderDelivery' => (object) $orderDelivery,
                'OrderHeader' => (object) $orderHeader,
                'OrderLines' => $orderLines,
            );

Example

$this->payload = {
       "OrderDelivery": {
         "Person": {
         "Gender": "Male",
         "Initials": "J",
         "FirstName": "John",
         "SurnamePrefix": "",
         "Surname": "Doe",
         "Company": "Stockbase",
         "EmailAddress": ""
       },
       "Address": {
         "Street": "Koraalrood",
         "StreetNumber": "33",
         "StreetNumberAddition": "A",
         "ZipCode": "2718SB",
         "City": "Zoetermeer",
         "CountryCode": "NLD"
       }
     },
     "OrderHeader": {
       "OrderNumber": "1574425588",
       "TimeStamp": "2019-11-15T15:56:36.1187035Z"
     },
     "OrderLines": 
     [{
      "Number": "1",
      "EAN": "8700000000001",
      "Amount": "1",
      "Price": "1.95"
     },
     {
      "Number": "2",
      "EAN": "8700000000002",
      "Amount": "1",
      "Price": "2.95"
    },
    {
     "Number": "3",
     "EAN": "8700000000003",
     "Amount": "1",
     "Price": "3.95"
    }]
  }

The Versions

30/05 2017

dev-master

9999999-dev https://github.com/DivideBV/PHPDivideIQ

PHP connector library for Divide IQ

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

30/05 2017

v0.5.0

0.5.0.0 https://github.com/DivideBV/PHPDivideIQ

PHP connector library for Divide IQ

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

10/01 2017

v0.4.0

0.4.0.0 https://github.com/DivideBV/PHPDivideIQ

PHP connector library for Divide IQ

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

11/08 2016

v0.3.0

0.3.0.0 https://github.com/DivideBV/PHPDivideIQ

PHP connector library for Divide IQ

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

13/08 2015

v0.2.0

0.2.0.0 https://github.com/DivideBV/PHPDivideIQ

PHP connector library for Divide IQ

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

07/08 2015

v0.1.0

0.1.0.0 https://github.com/DivideBV/PHPDivideIQ

PHP connector library for Divide IQ

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires