PHPackages                             diglin/swisspost-barcode-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. diglin/swisspost-barcode-php-sdk

ActiveLibrary[API Development](/categories/api)

diglin/swisspost-barcode-php-sdk
================================

PHP SDK for the use of SwissPost Barcode Webservice

1.0.3.3(5y ago)4939MITPHPPHP &gt;=5.3.3

Since Feb 20Pushed 5y ago2 watchersCompare

[ Source](https://github.com/diglin/swisspost-barcode-php-sdk)[ Packagist](https://packagist.org/packages/diglin/swisspost-barcode-php-sdk)[ RSS](/packages/diglin-swisspost-barcode-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (6)Used By (0)

Introduction
============

[](#introduction)

This SDK allows to use the SwissPost Barcode Webservice to generate Label or Barcode for shipment. Tracking code are returned from the API and can be used for later use.

Installation via Composer
-------------------------

[](#installation-via-composer)

Add the following requirements into your composer.json at root project level. You do not need to add an autoloader, composer will handle it for you if your application is compatible with it.

`composer require diglin/swisspost-barcode-php-sdk`

OR

```
 {
    "require" : {
        "diglin/barcode-swisspost-php-sdk": "1.*"
    },
    "repositories" : [
        {
            "type": "vcs",
            "url": "git@github.com:diglin/barcode-swisspost-php-sdk.git"
        }
    ]
 }

```

Usage
-----

[](#usage)

You can see some examples into the file `tutorial.php` or the test cases into the `test/ServiceType` folder.

For example to generate a Barcode:

```
    /**
     * Minimal options
     */
    $options = array(
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL      => $this->config->getWsdl(),
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN    => $this->config->getLogin(),
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => $this->config->getPassword(),
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Diglin\Swisspost\ClassMap::get(),
    );

    $generate = new \Diglin\Swisspost\ServiceType\Generate($options);

    $barcodeDefinition = new \Diglin\Swisspost\StructType\BarcodeDefinition();
    $barcodeDefinition
        ->setBarcodeType(\Diglin\Swisspost\EnumType\BarcodeType::VALUE_LSO_1)
        ->setImageFileType('PNG')
        ->setImageResolution(300);

    $struct = new \Diglin\Swisspost\StructType\GenerateBarcode($this->config->getLanguage(), $barcodeDefinition);

    try {
        /* @var $response GenerateBarcodeResponse */
        if ($generate->GenerateBarcode($struct) !== false) {
            $response = $generate->getResult();
        } else {
            $response = $generate->getLastError();
        }

        // PNG Picture to use further
        $barcode = $response->getData()->getBarcode();

        // ... your code here

    } catch (\SoapFault $e) {
        switch ($e->faultcode) {
            case 'HTTP':
                echo 'Login and/or password is not correct' . PHP_EOL;
                break;
            default:
                echo sprintf('Error occurred with the SOAP interface with the error message "%s"', $e->faultstring);
                break;
        }
    }

```

Generate classes for new API version
------------------------------------

[](#generate-classes-for-new-api-version)

run `composer install && php -f Generator.php`

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) file

License
-------

[](#license)

[MIT License](LICENSE.txt)

Author
------

[](#author)

- Diglin GmbH
-
- [@diglin\_](https://twitter.com/diglin_)
- [Follow me on github!](https://github.com/diglin)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~132 days

Total

5

Last Release

2107d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2fc49ae23a69f36d94772809d9dc7b9ad85d27ee1b054217e8b5483b5cfb1dc?d=identicon)[diglin](/maintainers/diglin)

---

Top Contributors

[![sylvainraye](https://avatars.githubusercontent.com/u/1337461?v=4)](https://github.com/sylvainraye "sylvainraye (10 commits)")

---

Tags

phpphp-sdksdkswisspost

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/diglin-swisspost-barcode-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/diglin-swisspost-barcode-php-sdk/health.svg)](https://phpackages.com/packages/diglin-swisspost-barcode-php-sdk)
```

###  Alternatives

[printu/elektroniczny-nadawca

Elektroniczny Nadawca WebAPI

1373.2k1](/packages/printu-elektroniczny-nadawca)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
