Today we are proud to introduce you to our PHP SDK!

Now you can use Marketcloud's API to build awesome eCommerce apps using the good old PHP programming language.

Unlike our client-sided SDKs, the PHP SDK gives you more power and more control over your eCommerce application, since you can use it to manipulate every aspect of your store.

For instance, you can manipulate your inventory, change a user's role, create and edit shipping methods and a lot more.

You can install it directly cloning the repository from GitHub

git clone

Or, if you like Composer, you can simply run:

composer require marketcloud/marketcloud-php

Once the SDK is installed and included in your project, you have to set your application's keys. If you don't have an account, you can create one here. Every account lets you create an application for free!

  'public_key' => 'public-key-here',
  'secret_key' => 'secret-key-here'

At this point you can start making api calls, let's see some very basic usage.

$query = array( "author" => "George Martin" );
$products = Marketcloud\Products::get($query); if ($products->body->status == true) { foreach ($product as $products->body->data) { echo "<div>".$product->name."</div>"; } }?>

That's it! This will output a list of products matching our query.

A common pattern is to initialize a cart and store it in the session:


if (!isset($_SESSION["marketcloud_cart_id"]) OR empty($_SESSION["marketcloud_cart_id"])) {
   $cart_response = Marketcloud\Carts::create();
   $_SESSION["marketcloud_cart_id"] = $cart_response->body->data->id;

} else {
   $cart_response = Marketcloud\Carts::getById($_SESSION["marketcloud_cart_id"]);
$_SESSION["marketcloud_cart_items_number"] = count($cart_response->body->data->items);
$cart = $cart_response->body->data;

Unlike client side SDKs, you can also query and manipulate orders

// Getting all orders
$orders = Marketcloud\Orders:get(array("user_id" => $_SESSION["user_id"]));
//Lets delete some order

As you can see, you can do pretty much everything with a server side SDK!

Let me know if you publish an eCommerce website using the PHP sdk! We will list it with the others "built with Marketcloud" ! Happy coding!