-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,71 @@ | ||
# Zasilkovna PHP | ||
# Zasilkovna client in PHP using SOAP or REST API | ||
|
||
[![Build Status](https://travis-ci.org/Salamek/zasilkovna.svg?branch=master)](https://travis-ci.org/Salamek/zasilkovna) | ||
[![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. | ||
|
||
|
||
## Requirements | ||
|
||
- PHP 5.4 or higher | ||
|
||
## 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:dev-master | ||
``` | ||
|
||
```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); | ||
``` |