Componette

Componette

Salamek

Salamek / zasilkovna 3.4.1

Zasilkovna.cz PHP library supporting SOAP and REST API + custom Label generator

download-cloud-line composer require salamek/zasilkovna

Zasilkovna client in PHP using SOAP or REST API

Integrity check 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

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);
  • 3.4.1 3.4.1

    What's Changed

    New Contributors

    Full Changelog: 3.3.1...3.4.1

  • 3.3.1 3.3.1

    What's Changed

    • Change carrierPickupPoint to string by @SiViN in #32

    New Contributors

    • @SiViN made their first contribution in #32

    Full Changelog: 3.3...3.3.1

  • 3.3 3.3

    What's Changed

    New Contributors

    Full Changelog: 3.2...3.3

  • 3.2 New release

    What is new

    • Fixed some issues with v4 branch api compatibility (Undefined index & co.)
    • Implemented new properties provided by v4 branch api (BranchStatus, displayFrontend, creditCardPayment)
    • ZasilkovnaBranch::getNameStreet() is now deprecated, use ZasilkovnaBranch::getName() instead
  • 3.1.4 3.1.4

    What is new

    • Fixed compatibility with PHP 7.4
    • Uses v4 of zasilkovna branch

    Full Changelog: 3.1.3...3.1.4

  • 3.1.3 Fixing release

    What's Changed

    • Update ZasilkovnaBranch.php by @ne2d in #27

    New Contributors

    • @ne2d made their first contribution in #27

    Full Changelog: 3.1.2...3.1.3

  • 3.1.2 Fixing release

    Fixes

    • Fixes crash when using supported PHP version due to usage of mixed type (PHP 8 only)
  • 3.1.1 3.1.1

    What's Changed

    New Contributors

    Full Changelog: 3.1...3.1.1

  • 3.1 Fixing release (BC Break)

    Fixes

    • Fixes inconsistency in ApiRest::packetsLabelsPdf (#7), array $packetIds is now array of strings (same as SoapRest::packetsLabelsPdf):

    Simply put, change your code from:

    $packetIds = ['id' => [
        "ID1",
        "ID2"
    ]];
    ApiRest::packetsLabelsPdf($packetIds, ...);
    

    To

    $packetIds =[
        "ID1",
        "ID2"
    ];
    ApiRest::packetsLabelsPdf($packetIds, ...);
    

    This fix is OFC a BC break

  • 3.0 New release (BC break)

    Features

    • $packetId is now string (or string[] in functions where it makes sense). This is BC break in parameter type!
    • Add native support for find nearest branches. (@janbarasek)
    • API Key validation. (@janbarasek)
    • Storage is now optional for Branch (@janbarasek)
    • Lazy load branches for better performance. (@janbarasek)
    • Email and phone checks in PacketAttributes (@Salamek @janbarasek)

    Fixes

  • 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

Componette Componette felix@nette.org