Skip to content

zoltanlaca/isklad-api-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iSklad API Connector

The iSklad API Connector library enables you to communicate with iSklad API.

API documentation: isklad/egon-api-documentation

Requirements

Installation

You can use Composer or simply Download the Release

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

composer require zoltanlaca/isklad-api-connector

Finally, be sure to include the autoloader:

require_once '/path/to/your-project/vendor/autoload.php';

Download the Release

If you prefer not to use composer, you can download the package in its entirety. The Releases page lists all stable versions.

Uncompress the zip file you download, and include the autoloader in your project:

require_once '/path/to/isklad-api-connector/vendor/autoload.php';

Examples

See the examples/ directory for examples of the key features.

Basic Example

// import classes
use ZoltanLaca\IskladApiConnector\Connector;
use ZoltanLaca\IskladApiConnector\ConnectorException;

// include composer autoload file
include_once dirname(__DIR__) . '/vendor/autoload.php';

// create connector instance
$connector = New Connector('123456', 'xxx', 'xxx');

try {
    $response = $connector
        // set the input data to the request
        ->createRequest('GetOrderStatus', [
            'original_order_id' => 123,
        ])
        // send to api
        ->send()
        // get parsed response from connector
        ->getResponseHeaders();

        // print it
        print_r($response);
} catch (ConnectorException $exception) {
    // handle error
    print_r(sprintf('Connection ERROR: %s', $exception->getMessage()));
}