engazan / mrp-ks-laravel
Laravel wrapper package for the MRP K/S API
1.0.0
2021-05-02 20:15 UTC
Requires
- php: ^8.0
- ext-openssl: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.3
README
- PHP (8) Laravel 8 wrapper for MRP K/S
- client have to activate MRP K/S - https://faq.mrp.sk/e-shop-nastavenia/Ako-prepojit-MRP-K-S-s-internetovym-obchodom-538
FEATURES
- encryption (aes-256-ctr)
INSTALL
composer require engazan/mrp-ks-laravel
run php artisan vendor:publish
look for Engazan\MrpKs\MrpKsServiceProvider
Config .env
MRP_KS_URI=192.168.0.166 MRP_KS_PORT=120 MRP_KS_USERNAME=MRPDBA MRP_KS_PASSWORD=MRPDBA MRP_KS_ENCRYPTION_KEY=
- if
MRP_KS_ENCRYPTION_KEY
is provided all request are sent as ENCRYPTED, also you need DECRYPT response XML
USAGE
use Engazan\MrpKs\MrpKs; use Engazan\MrpKs\MrpKsResponse; $productFilter = [ 'malObraz' => 'T', 'velObraz' => 'F', 'SKKAR.CISLO' => '500..510', ]; // products $response = MrpKs::EXPEO0($productFilter); $response = MrpKs::EXPEO1($productFilter); // addresses $response = MrpKs::ADREO0(); // prices (default filter "cenovaSkupina" is set to "1") $response = MrpKs::CENEO0(); // CHAINED calls $mrpKs = new MrpKs(); $response = $mrpKs->setCommand('EXPEO0') ->setFilters($productFilter) ->sendRequest(); // DECRYPT response (needed only if MRP_KS_ENCRYPTION_KEY is filled) if (config('mrp-ks.encryption')) { $decryptedResponse = MrpKsResponse::decryptEncryptedResponse($response); }