Statistics
2213
3
1
23d
Badges
Tags
api
Dependencies

Zasilkovna client in PHP using SOAP or REST API

Build Status Donate

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:dev-master

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);
  • v2.0.1 New release

    Enhanecements

    • Add native support for find nearest branches. (@janbarasek)
  • v2.0.0 New release (BC break)

    This release brings BC break, mainly that PHP5 compatibility is dropped and suggested PHP version is now 7.4!
    If you need to use PHP <7.4 you may need to stay on v1.* of this library

    Enhancements by @janbarasek

    • Full type-hint support (return values as a strictly declared entity)
    • Full PHP 7.4 support
    • Automated tests by GitHub ActIons
    • PhpStan and Code style test is OK
    • Use generic exceptions, better maintability
    • Deprecated code removed

    Fixes by @janbarasek

    • Fix composer dependencies
    • Fix lots of old mistakes + removed redundant code
  • v1.1.2 Fixing release

    Fixes

    • Fixes incorrect equality comparison
  • v1.1.1 Fixing release

    Fixes missing use

  • V1.1.0 New release

    • Add better exception for PacketAttributesFault (Potential BC break in Exception handling) (@martinknor)
  • v1.0.1

  • v1.0 First release

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com