imper86 / php-baselinker-api
Simple wrapper for Baselinker.com API
v1.3.0
2024-05-08 18:43 UTC
Requires
- php: >=7.4
- ext-json: *
- imper86/http-client-builder: ^2.0
- imper86/php-http-cache-plugin: ^2.0
- jawira/case-converter: ^3.4
- myclabs/php-enum: ^1.8
Requires (Dev)
- http-interop/http-factory-guzzle: ^1.0
- imper86/vbump: ^v1.0
- php-http/guzzle6-adapter: ^2.0
- phpstan/phpstan: ^0.12.80
- symfony/var-dumper: ^5.2
README
Installation
composer require imper86/php-baselinker-api
HTTPlug note
This lib uses HTTPlug so it doesn't depend on any http client. In order to use this lib you must have some PSR-18 http client and PSR-17 http factories. If you don't know which one you shoud install you can require these:
composer require php-http/guzzle6-adapter http-interop/http-factory-guzzle
Usage
Using this library is very simple, fast example should be enough to understand how it works.
<?php use Imper86\PhpBaselinkerApi\BaselinkerApi; use Imper86\PhpBaselinkerApi\Model\Orders\GetJournalList\GetJournalListRequest; use Imper86\PhpBaselinkerApi\Model\ProductsStorage\GetProductsList\GetProductsListRequest; use Imper86\PhpBaselinkerApi\Plugin\ErrorPlugin; require_once __DIR__ . '/vendor/autoload.php'; $token = 'your-api-token'; $api = new BaselinkerApi($token); $api->addPlugin(new ErrorPlugin()); $productsResponse = $api->productsStorage()->getProductsList(new GetProductsListRequest('bl_1')); var_dump($productsResponse); $journalResponse = $api->orders()->getJournalList(new GetJournalListRequest(123456)); var_dump($journalResponse);
Contributing
Any help will be very appreciated :)