Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/salamek/zasilkovna
Zasilkovna.cz PHP library supporting SOAP and REST API + custom Label generator
https://github.com/salamek/zasilkovna
label-printer rest-client soap-client zasilkovna
Last synced: 10 days ago
JSON representation
Zasilkovna.cz PHP library supporting SOAP and REST API + custom Label generator
- Host: GitHub
- URL: https://github.com/salamek/zasilkovna
- Owner: Salamek
- License: lgpl-3.0
- Created: 2017-08-02T22:23:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-20T12:33:30.000Z (5 months ago)
- Last Synced: 2024-12-17T05:15:36.577Z (17 days ago)
- Topics: label-printer, rest-client, soap-client, zasilkovna
- Language: PHP
- Homepage:
- Size: 159 KB
- Stars: 9
- Watchers: 3
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zasilkovna client in PHP using SOAP or REST API
[![Integrity check](https://github.com/Salamek/zasilkovna/actions/workflows/main.yml/badge.svg)](https://github.com/Salamek/zasilkovna/actions/workflows/main.yml)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=D8LQ4XTBLV3C4&lc=CZ&item_number=SalamekZasilkovna¤cy_code=EUR)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](http://getcomposer.org/)
```sh
$ composer require salamek/zasilkovna
```or if you want master branch code:
```sh
$ composer require salamek/zasilkovna
```## Documentation
See http://www.zasilkovna.cz/popis-api/ for more info
## Example code
```php
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);
```