Arcadier SDK for PHP

The PHP SDK is an API wrapper that allows developers of PHP applications to quickly integrate with Arcadier's APIs. It presents a simple and intuitive interface, making it easier for developers to work with our APIs.

Requirements

  • A Client ID and Client Secret, which can be obtained following the instructions here
  • Subscriptions to Arcadier to Scale or Enterprise packages
  • Composer, if installing through Packagist
  • PHP 7.0.0+

Installation

  • Composer
    • Composer is a dependency management tool for PHP. It makes it easier for you to manage your PHP dependencies/packages by handling updates, versioning, etc. If you are new to composer, refer to this document for installation steps.
    • Once composer is installed, you can run a command to install the PHP library. Contact us to get the command line.
    • Composer will automatically setup and manage the dependencies, such as updating your composer.json file
  • On Arcadier's servers
    • The SDK can also be directly downloaded/cloned from GitHub and installed inside your plugin's directory.

Documentation

The complete SDK for PHP documentation can be viewed at: arcadier.github.io/php-sdk

You can also view Arcadier's API documentation, which provides all the relevant information on our REST APIs. You can find them here.


Quick Start

After installing the SDK in your directory using either Composer or cloning from GitHub,

  1. Create a new PHP file
  2. Write the following code to include the SDK's classes in your code:
    require '/path-to-sdk/api.php';
    $sdk = new ApiSdk();
    $response = $sdk->getAllItems(null);

The response will contain the listing of all items in the marketplace.

Examples

Simple Item Search page

This Item search page was built with the PHP SDK at its core performing all the API calls to the marketplace it's set to connect to.

Try it on your local computer by installing a PHP server using Xampp and downloading the files from the Github repository linked above and following the instructions.

Source code: Arcadier GitHub

Request For Quotation Plug-In

This seemingly complex Plug-In was rendered easy to develop due to the fact that the backend was made easy to handle by the PHP SDK. The only intense focus that was required was on the UI aspect of the plugin.

Try it on your sandbox marketplace by downloading the files from the Github repository linked above and following the instructions.

Source code: Arcadier Github


Usage

<?php
//initialise the SDK
require "path-to-sdk\api.php";
$sdk = new ApiSdk();

//Get categories API
$category_list = $sdk->getCategories();
if(isset($category_list['Records'])) {
    $category_list = $category_list['Records'];
}
?>

//create a dropdown of categories on your page
<select id="categories" name="categories">
        <option value="null">Choose a category</option>
        <?php
            if($category_list != null){
                foreach ($category_list as $cat) {
                    echo '<option value='.$cat['ID'].'>'.$cat['Name'].'</option>';
                }
            }
        ?>
</select>