salamek / zasilkovna
Zasilkovna SOAP and REST client in PHP
Installs: 42 078
Dependents: 1
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 19
Open Issues: 2
Requires
- php: >=7.4.0
- spatie/array-to-xml: ^2.15
- tecnickcom/tcpdf: ^6.3
Requires (Dev)
- phpstan/phpstan: ^0.12.18
- phpstan/phpstan-nette: ^0.12.6
- tracy/tracy: ^2.7
README
This library provides SOAP and REST API implementations. Additionaly Branch implementation to fetch and store branch data and label implementation to generate labels.
Installation
Install salamek/zasilkovna using Composer
$ composer require salamek/zasilkovna
or if you want master branch code:
$ composer require salamek/zasilkovna
Documentation
See http://www.zasilkovna.cz/popis-api/ for more info
Example code
require "vendor/autoload.php"; $api = new Salamek\Zasilkovna\ApiRest($apiPassword, $apiKey); // OR Soap implementation $api = new Salamek\Zasilkovna\ApiSoap($apiPassword, $apiKey); $branch = new Branch($apiKey, new BranchStorageSqLite()); // There are multiple implementations of IBranchStorage BranchStorageSqLite using SQLite, BranchStorageFile using file in /tmp and BranchStorageMemory using simple variable (SLOW), You can implement your own by implementing IBranchStorage interface $label = new Label($api, $branch); // To greate new packet $transporterPackage = new PacketAttributes( 'ORDERID', 'FirstName', 'LastName', null, 'addressId', null, 'Company', 'Email', 'Phone', null, null, null, 'www', false, 'Street', 'StreetNumber', 'City', 'ZipCode' ); $api->createPacket($transporterPackage); // Generate A4 label $label->generateLabelFull($pdf, $transporterPackage); // Generate A2 label $label->generateLabelQuarter($pdf, $transporterPackage); // Get full branch list as array $branch->getBranchList(); // Returns branch detail by ID $branch->find($branchId);