There is no license information available for the latest version (2.0.0) of this package.

Small sdk for connecting to OpenSoft Job Submission Interface

2.0.0 2023-08-24 16:36 UTC

This package is auto-updated.

Last update: 2024-04-24 18:15:21 UTC


InkRouter's PHP SDK is the Job Submission interface to the InkRouter Printing Network. To send print orders directly from your website to InkRouter, you will use the InkRouter PHP SDK as documented here.

The InkRouter PHP SDK is a library for easy interaction with the InkRouter interface from PHP.

Build Status


This SDK requires:

  • PHP 5.0.x and up
  • libxml PHP extension


With Composer:

$ composer require opensoft/inkrouter-php-sdk

Without Composer:

  • Download a zip file
  • Unpack downloaded zip in any directory in your project (for example /path/to/your/project/libs/InkRouter)
  • InkRouter PHP SDK can use any PSR0 compatible autoloader, or you can use the one included in tests/bootstrap.php with a simple require_once statement

InkRouter Workflow

InkRouter interface workflow consists of 6 actions:

  • Get InkRouter client instance
  • Create and fill InkRouter_Models_OrderInfo instance
  • Create order to InkRouter
  • Update order (optional)
  • Place on hold order (optional)
  • Remove hold order (optional)
  • Cancel order (optional)
  • Receive order updates from InkRouter

Get InkRouter client instance

Prior to performing any operations, perform get instance of InkRouter client, example:

$InkRouterClient = new InkRouter_Client_Client($wsdl, $printCustomerId, $secretKey);


  • $wsdl is url of InkRouter service
  • $printCustomerId is your unique identificator from InkRouter
  • $secretKey is your secret key

Create InkRouter_Models_OrderInfo instance (with example data)

$contact = new InkRouter_Models_Contact();

$headerInfo = new InkRouter_Models_HeaderInfo();

$shipType = new InkRouter_Models_ShipType();

$shipAddress = new InkRouter_Models_ShipAddress();
    ->setStreetAddress('742 Evergreen Terrace')

$requester = new InkRouter_Models_Requester();
$requester->setName('Any Prints')

$poInfo = new InkRouter_Models_PoInfo();

$printAsset = new InkRouter_Models_PrintAsset();

$side = new InkRouter_Models_Side();

$attributes = new InkRouter_Models_Attributes_ScalarBooleanAttribute();
$orderItem = new InkRouter_Models_OrderItem();
    ->setProductType('business cards')

$order = new InkRouter_Models_Order();
    ->setTsCreated(date(DATE_ATOM, strtotime('now')))

$orderInfo = new InkRouter_Models_OrderInfo();

Create order to InkRouter

After creating the instance of InkRouter Models_OrderInfo Create Order to InkRouter as below:

try {
    $orderId = $InkRouterClient->createOrder($timestamp, $orderInfo);
} catch (InkRouter_Exceptions_Exception $e) {
    echo 'Create operation failed';


  • $timestamp is unix timestamp (result of mktime() function), if your last operation was unsuccessful, you can resend it with same timestamp
  • $orderInfo is an instance of InkRouter_Models_OrderInfo (see example)
  • $orderId is an order identification, received from InkRouter

Update order

You should first create instance of InkRouter Models OrderInfo and call update method:

try {
    $InkRouterClient->updateOrder($orderId, $timestamp, $orderInfo);
} catch (InkRouter_Exceptions_Exception $e) {
    echo 'Update operation failed';


  • $orderId is identifier of order for update

Place on hold order

For place on hold order with id $orderId you should do:

try {
    $InkRouterClient->placeOnHold($orderId, $timestamp);
} catch (InkRouter_Exceptions_Exception $e) {
    echo 'Place on hold operation failed';

Remove hold order

For remove order from hold with id $orderId you should do:

try {
    $InkRouterClient->removeHold($orderId, $timestamp);
} catch (InkRouter_Exceptions_Exception $e) {
    echo 'Remove hold operation failed';

Cancel order

For cancel order with id $orderId you should do:

try {
    $InkRouterClient->cancelOrder($orderId, $timestamp);
} catch (InkRouter_Exceptions_Exception $e) {
    echo 'Cancel operation failed';

Receive order updates from InkRouter

For successful receiving update messages from InkRouter, you should make any controller, which can receive post requests, add url of this controller in your account through InkRouter-dashboard. Then you can use InkRouter_Response_Response class for parsing xml string from post content:

$updates = InkRouter_Response_Response::fromPack($xml)->getUpdates();

where $updates is array of InkRouter_Response_Update objects and you can use it as you want.