You need PHP 5.5 and later. Additionally, make sure that the following PHP extensions are installed on your server:
You can install the client via Composer by running the command:
composer require monetivo/shoper-json-api-php
Then use Composer's autoload mechanism:
require_once('vendor/autoload.php');
If you do not wish to use Composer, you can download the latest release. Then include the autoload.php
file.
require_once('/path/to/shoper-json-api-php/autoload.php');
Basic usage looks like:
<?php
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();
}
See https://www.shoper.pl/api for information about acquiring webapi credentials and documentation of available methods.
If you find any issues, please do not hesitate to file them via GitHub.