{"id":18963787,"url":"https://github.com/opensoft/inkrouter-php-sdk","last_synced_at":"2025-04-19T12:37:21.708Z","repository":{"id":18159545,"uuid":"21257608","full_name":"opensoft/InkRouter-PHP-SDK","owner":"opensoft","description":"PHP SDK for InkRouter","archived":false,"fork":false,"pushed_at":"2023-08-24T16:38:00.000Z","size":198,"stargazers_count":2,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T01:43:05.156Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opensoft.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-26T23:01:22.000Z","updated_at":"2023-02-13T15:35:27.000Z","dependencies_parsed_at":"2024-11-08T14:22:36.101Z","dependency_job_id":"c090dd26-7216-49ad-9bfd-95da5f0d00ac","html_url":"https://github.com/opensoft/InkRouter-PHP-SDK","commit_stats":{"total_commits":33,"total_committers":14,"mean_commits":2.357142857142857,"dds":0.8484848484848485,"last_synced_commit":"5e0ad63cf7f7fd6e18437f6901d3245e88592c2e"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FInkRouter-PHP-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FInkRouter-PHP-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FInkRouter-PHP-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FInkRouter-PHP-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opensoft","download_url":"https://codeload.github.com/opensoft/InkRouter-PHP-SDK/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249201117,"owners_count":21229004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T14:21:41.009Z","updated_at":"2025-04-16T05:31:26.161Z","avatar_url":"https://github.com/opensoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n============\n\nInkRouter'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\nthe InkRouter PHP SDK as documented here.\n\nThe InkRouter PHP SDK is a library for easy interaction with the InkRouter interface from PHP.\n\n[![Build Status](https://travis-ci.org/opensoft/InkRouter-PHP-SDK.svg?branch=master)](https://travis-ci.org/opensoft/InkRouter-PHP-SDK)\n\nRequirements\n============\n\nThis SDK requires: \n\n- PHP 5.0.x and up\n- libxml PHP extension\n\nInstallation\n============\n\nWith Composer:\n\n    $ composer require opensoft/inkrouter-php-sdk\n    \nWithout Composer:\n\n- Download a zip [file](https://github.com/opensoft/InkRouter-PHP-SDK/zipball/1.0)\n- Unpack downloaded zip in any directory in your project (for example /path/to/your/project/libs/InkRouter)\n- InkRouter PHP SDK can use any PSR0 compatible autoloader, or you can use the one included in `tests/bootstrap.php`\n  with a simple `require_once` statement\n\nInkRouter Workflow\n==================\n\nInkRouter interface workflow consists of 6 actions:\n\n- Get InkRouter client instance\n- Create and fill InkRouter_Models_OrderInfo instance\n- Create order to InkRouter\n- Update order (optional)\n- Place on hold order (optional)\n- Remove hold order (optional)\n- Cancel order (optional)\n- Receive order updates from InkRouter\n\nGet InkRouter client instance\n-----------------------\nPrior to performing any operations, perform get instance of InkRouter client, example:\n\n    $InkRouterClient = new InkRouter_Client_Client($wsdl, $printCustomerId, $secretKey);\n\nWhere:\n\n- `$wsdl` is url of InkRouter service\n- `$printCustomerId` is your unique identificator from InkRouter\n- `$secretKey` is your secret key\n\nCreate InkRouter_Models_OrderInfo instance (with example data)\n---------------------------------\n\n    $contact = new InkRouter_Models_Contact();\n    $contact-\u003esetName('contact_name')\n        -\u003esetPhone('contact_phone')\n        -\u003esetEmail('contact_email');\n\n    $headerInfo = new InkRouter_Models_HeaderInfo();\n    $headerInfo-\u003esetFromDomain('yoursite.com')\n        -\u003esetFromIdentity('your_identity');\n\n    $shipType = new InkRouter_Models_ShipType();\n    $shipType-\u003esetMethod('UPS')\n        -\u003esetServiceLevel('GROUND');\n\n    $shipAddress = new InkRouter_Models_ShipAddress();\n    $shipAddress-\u003esetAttention('Attention')\n        -\u003esetStreetAddress('742 Evergreen Terrace')\n        -\u003esetCity('Springfield')\n        -\u003esetState('CA')\n        -\u003esetZip('1234567')\n        -\u003esetCountry('USA');\n\n    $requester = new InkRouter_Models_Requester();\n    $requester-\u003esetName('Any Prints')\n        -\u003esetContract('STANDARD')\n        -\u003esetPayTerm('FREE');\n\n    $poInfo = new InkRouter_Models_PoInfo();\n    $poInfo-\u003esetAgentId('agentId')\n        -\u003esetCurrency('US');\n\n    $printAsset = new InkRouter_Models_PrintAsset();\n    $printAsset-\u003esetPositionX(4.98)\n        -\u003esetPositionY(3.1)\n        -\u003esetRotation(-90)\n        -\u003esetType('BARCODE')\n        -\u003esetHeight(0.543)\n        -\u003esetWidth(2.12);\n\n    $side = new InkRouter_Models_Side();\n    $side-\u003esetPageNumber(10)\n        -\u003esetFileUrl('http://server/img.jpg')\n        -\u003esetFileHash('0a0825909aa15a98b00574661f23aee7')\n        -\u003esetCoating('NONE')\n        -\u003esetOrientation('Landscape')\n        -\u003eaddPrintAsset($printAsset);\n\n    $attributes = new InkRouter_Models_Attributes_ScalarBooleanAttribute();\n        $attributes-\u003esetType('LABELING');\n        $attributes-\u003esetValue(true);\n            \n    $orderItem = new InkRouter_Models_OrderItem();\n    $orderItem-\u003esetPrintGroupId('pg4f7969f8a4811')\n        -\u003esetProductType('business cards')\n        -\u003esetPaperType('14PT')\n        -\u003esetQuantity(500)\n        -\u003esetRegionSize('US')\n        -\u003esetCost(20.3)\n        -\u003eaddAttributes($attributes)\n        -\u003eaddSide($side);\n\n    $order = new InkRouter_Models_Order();\n    $order-\u003esetPrintCustomerInvoice(123456789)\n        -\u003esetTsCreated(date(DATE_ATOM, strtotime('now')))\n        -\u003esetPriority(0)\n        -\u003esetShippingFee(10)\n        -\u003esetProductDiscounts(0)\n        -\u003esetShippingDiscounts(0)\n        -\u003esetVendorId('vendor_id')\n        -\u003esetContact($contact)\n        -\u003esetShipType($shipType)\n        -\u003esetRequester($requester)\n        -\u003esetShipAddress($shipAddress)\n        -\u003eaddOrderItem($orderItem);\n\n    $orderInfo = new InkRouter_Models_OrderInfo();\n    $orderInfo-\u003esetHeaderInfo($headerInfo)\n        -\u003esetPrintCustomerId('ID')\n        -\u003esetPoInfo($poInfo)\n        -\u003esetOrder($order);\n\nCreate order to InkRouter\n--------------\nAfter creating the instance of InkRouter Models_OrderInfo Create Order to InkRouter as below:\n\n    try {\n        $orderId = $InkRouterClient-\u003ecreateOrder($timestamp, $orderInfo);\n    } catch (InkRouter_Exceptions_Exception $e) {\n        echo 'Create operation failed';\n    }\n    \n\nWhere:\n\n- `$timestamp` is unix timestamp (result of mktime() function), if your last operation was unsuccessful, you can resend it with same timestamp\n- `$orderInfo` is an instance of InkRouter_Models_OrderInfo (see example)\n- `$orderId` is an order identification, received from InkRouter\n\nUpdate order\n------------\nYou should first create instance of InkRouter Models OrderInfo and call update method:\n\n    try {\n        $InkRouterClient-\u003eupdateOrder($orderId, $timestamp, $orderInfo);\n    } catch (InkRouter_Exceptions_Exception $e) {\n        echo 'Update operation failed';\n    }            \n    \nWhere:\n\n- `$orderId` is identifier of order for update\n\nPlace on hold order\n-------------------\nFor place on hold order with id `$orderId` you should do:\n    \n    try {\n        $InkRouterClient-\u003eplaceOnHold($orderId, $timestamp);\n    } catch (InkRouter_Exceptions_Exception $e) {\n        echo 'Place on hold operation failed';\n    }  \n\nRemove hold order\n-----------------\nFor remove order from hold with id `$orderId` you should do:\n\n    try {\n        $InkRouterClient-\u003eremoveHold($orderId, $timestamp);\n    } catch (InkRouter_Exceptions_Exception $e) {\n        echo 'Remove hold operation failed';\n    }\n\nCancel order\n-----------------\nFor cancel order with id `$orderId` you should do:\n\n    try {\n        $InkRouterClient-\u003ecancelOrder($orderId, $timestamp);\n    } catch (InkRouter_Exceptions_Exception $e) {\n        echo 'Cancel operation failed';\n    }\n\nReceive order updates from InkRouter\n--------------------------\nFor 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:\n\n    $updates = InkRouter_Response_Response::fromPack($xml)-\u003egetUpdates();\n\nwhere `$updates` is array of InkRouter_Response_Update objects and you can use it as you want.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensoft%2Finkrouter-php-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopensoft%2Finkrouter-php-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensoft%2Finkrouter-php-sdk/lists"}