PHP code example of monetivo / shoper-json-api-php

1. Go to this page and download the library: Download monetivo/shoper-json-api-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

monetivo / shoper-json-api-php example snippets








try {
    // Shoper shop url
    $shopUrl = 'https://shop.url/';

    // webapi user login
    $login = 'webapi';

    // webapi user password
    $password = 's33m$d!FFicult';

    // init client
    $client = new \Monetivo\ShoperJsonApi($shopUrl);

    // try login, throws exception on fail
    $client->login($login, $password);

    //example - get order list
    $orderList = $client->orderList(true, false, null);

    $client->logout();
}
catch (\Monetivo\Exceptions\MonetivoException $e)
{
    // Shoper error message
    $e->getMessage();
    // Shoper error code
    $e->getCode();
}