zoltanlaca/isklad-api-connector

Lightweight connector to isklad.eu rest API

v1.5 2024-04-03 08:20 UTC

This package is auto-updated.

Last update: 2024-10-03 09:18:31 UTC


README

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()));
}