PHPPwinty: A PHP Library for

PHPPwinty is a PHP library for communicating with the Pwinty API. Pwinty provides an easy API to let your users order photo prints from within your application.

This class was developed for Picisto, and now I'm releasing it to the world for all to enjoy.



To integrate PHPPwinty into your PHP application, you just need to include the single PHPPwinty.php file. There's a PWINTY_LIVE constant defined at the top of the file. Set this to false while you test with the Pwinty sandbox. require_once("PHPPwinty.php");


To start making calls to the Pwinty API, all you have to do is create a PHPPwinty object, create an order, and start adding photos and documents to the order. See below for a full example of a complete order submission. require_once("PHPPwinty.php");
$pwinty = new PHPPwinty();

// create the order
$order = $pwinty->createOrder("John Doe", "123 Evergreen Terrace", "", "Beverly Hills", "CA", "90210", "United States", "Photos by Picisto");

// add some photos
$photo1 = $pwinty->addPhoto($order, "4x6", "", "1", "ShrinkToFit");
$photo2 = $pwinty->addPhoto($order, "6x6", "", "4", "ShrinkToFit");
$photo3 = $pwinty->addPhoto($order, "5x7", "", "3", "ShrinkToFit");

// add a document
$document = $pwinty->addDocument($order, "invoice.pdf");

// add a sticker
$document = $pwinty->addSticker($order, "sticker.jpg");

// view the order, make sure it's all there
$order_details = $pwinty->getOrder($order);

// submit the order
$pwinty->updateOrderStatus($order, "Submitted");


PHPPwinty.php has been developed and tested in PHP5, but it should work in PHP4. It requires the cURL PHP extension to be enabled.


I'm releasing this code under Creative Commons. Feel free to use, share, and remix. However you must attribute the work back to this page.

Help & Support

If you have any questions or comments, please contact me and let me know.

Join the Discussion!

comments powered by Disqus