PHPackages                             markosirec/gls-italy-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. [HTTP &amp; Networking](/categories/http)
4. /
5. markosirec/gls-italy-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

markosirec/gls-italy-sdk
========================

PHP SDK for the GLS Italy

v2.1.1(4y ago)136.4k↓45.5%11[2 issues](https://github.com/markosirec/gls-italy-sdk/issues)[1 PRs](https://github.com/markosirec/gls-italy-sdk/pulls)MITPHPPHP &gt;=7.1.0CI failing

Since Jul 2Pushed 4y ago2 watchersCompare

[ Source](https://github.com/markosirec/gls-italy-sdk)[ Packagist](https://packagist.org/packages/markosirec/gls-italy-sdk)[ RSS](/packages/markosirec-gls-italy-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (11)Used By (0)

GLS Italy PHP SDK
=================

[](#gls-italy-php-sdk)

This is an unofficial PHP SDK for the GLS Italy webservice. Since the official documentation and API are both in Italian, things can get quite confusing. Therefore I decided to create a simple SDK with which you can easily integrate your existing project.

Please note - GLS Italy has its own unique API and is very different from GLS branches in other countries.

What's new
----------

[](#whats-new)

### v2.0.0

[](#v200)

Adding and closing packets is now done in batches. You pass an array of Parcel instances instead of making a call for each individual parcel. (please have a look at the example below)

Getting Started
---------------

[](#getting-started)

### Prerequisites

[](#prerequisites)

- PHP 7.1
- PHP curl library

### Installing

[](#installing)

Clone/download this repo directly or get it through composer:

```
composer require markosirec/gls-italy-sdk

```

Usage
-----

[](#usage)

### List parcels

[](#list-parcels)

Here is an example of how to get a list of parcels in the GLS system. These endpoints can sometimes return weird or incomplete results - seems to be a bug in the GLS system. Keep in mind your mileage may vary!

```
$auth = new MarkoSirec\GlsItaly\SDK\Models\Auth();

$auth->setBranchId('your-branch-id');
$auth->setClientId('your-client-id');
$auth->setContractId('your-contract-id');
$auth->setPassword('your-password');

// List parcels for the last 40 days
$parcels = MarkoSirec\GlsItaly\SDK\Services\ParcelService::list($auth);

// List parcels by status (1 = closed parcels, 0 = waiting)
$parcels = MarkoSirec\GlsItaly\SDK\Services\ParcelService::listByStatus($auth, 1);

// List parcels by date/period (YYYYMMDD or YYYYMMDDHHII)
$parcels = MarkoSirec\GlsItaly\SDK\Services\ParcelService::listByPeriod($auth, "202001221300", "202001221700");

```

### Add parcels and generate the PDF label/sticker

[](#add-parcels-and-generate-the-pdf-labelsticker)

For a full list of options, take a look at the Parcel model in src/Models/Parcel.php

```
$auth = new MarkoSirec\GlsItaly\SDK\Models\Auth();

$auth->setBranchId('your-branch-id');
$auth->setClientId('your-client-id');
$auth->setContractId('your-contract-id');
$auth->setPassword('your-password');

$parcels = [];

$parcel = new MarkoSirec\GlsItaly\SDK\Models\Parcel();
$parcel->setName('John Smith');
$parcel->setAddress('Via su vrangone, 191');
$parcel->setCity('SOS ALINOS');
$parcel->setPostcode('08028');
$parcel->setProvince('NU');
$parcel->setWeight('2,7');
$parcel->setEmail('email@client.com');
$parcel->setOrderId(12345);
$parcels[] = $parcel;

$parcel = new MarkoSirec\GlsItaly\SDK\Models\Parcel();
$parcel->setName('Barbara Jordan');
$parcel->setAddress('Via Roma, 12');
$parcel->setCity('SOS ALINOS');
$parcel->setPostcode('08028');
$parcel->setProvince('NU');
$parcel->setWeight('2,1');
$parcel->setEmail('email2@client.com');
$parcel->setOrderId(12346);
$parcels[] = $parcel;

$result = MarkoSirec\GlsItaly\SDK\Services\ParcelService::add($auth, $parcels);

foreach ($result as $parcel) {

    if (empty($parcel->getError())) {

        // this is your tracking code/id. I suggest you save it!
        $parcelId = $parcel->getParcelId();

        // generate the PDF
        file_put_contents(
            $parcelId.'.pdf',
            base64_decode($parcel->getPdfLabel())
        );
    }
}

try {

    // After the parcels have been added, the webservice needs you to confirm the shipping by calling the close endpoint.
    // You can also do this later if you wish. This is the equivalent of the "CloseWorkDay" endpoint.
    // You need to supply the parcels you want to "close".
    MarkoSirec\GlsItaly\SDK\Services\ParcelService::close($auth, $parcels);
}

catch(Exception $e) {

    // get the raw response error
    var_dump($e->getResponse());

    // get parsed xml from the GLS response (if the XML was parsed)
    var_dump($e->getXmlResponse());
}

```

### Delete parcel

[](#delete-parcel)

```
$auth = new MarkoSirec\GlsItaly\SDK\Models\Auth();

$auth->setBranchId('your-branch-id');
$auth->setClientId('your-client-id');
$auth->setContractId('your-contract-id');
$auth->setPassword('your-password');

// this is the parcel id/tracking code you received from GLS when you added the parcel
$parcelId = 123;

// returns true on success, false on error
$result = MarkoSirec\GlsItaly\SDK\Services\ParcelService::delete($auth, $parcelId);

```

Running the tests
-----------------

[](#running-the-tests)

The SDK uses phpunit for tests. Cd into the SDK root folder and run:

```
vendor/bin/phpunit tests

```

Contributing
------------

[](#contributing)

Pull requests are very welcome. (Please use the PSR-2 coding style) This library does not yet support certain API features/endpoints so if you have a specific wish, please contact me and I will try to help.

Authors
-------

[](#authors)

- [Marko Širec](https://github.com/markosirec) - Initially created this Project

Contact
-------

[](#contact)

- If you have questions or feature requests please email me at
- (sorry, I don't speak Italian)

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~107 days

Recently: every ~164 days

Total

10

Last Release

1542d ago

Major Versions

v1.0.4 → v2.0.02020-05-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7317045?v=4)[Marko Širec](/maintainers/markosirec)[@markosirec](https://github.com/markosirec)

---

Top Contributors

[![markosirec](https://avatars.githubusercontent.com/u/7317045?v=4)](https://github.com/markosirec "markosirec (12 commits)")[![luxxi](https://avatars.githubusercontent.com/u/1362438?v=4)](https://github.com/luxxi "luxxi (1 commits)")[![simonsinart](https://avatars.githubusercontent.com/u/5908777?v=4)](https://github.com/simonsinart "simonsinart (1 commits)")[![thugic](https://avatars.githubusercontent.com/u/22091704?v=4)](https://github.com/thugic "thugic (1 commits)")

---

Tags

ecommercelogisticsgls

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/markosirec-gls-italy-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/markosirec-gls-italy-sdk/health.svg)](https://phpackages.com/packages/markosirec-gls-italy-sdk)
```

###  Alternatives

[jlevers/selling-partner-api

PHP client for Amazon's Selling Partner API

4295.2M1](/packages/jlevers-selling-partner-api)[bigcommerce/api

Enables PHP applications to communicate with the Bigcommerce API.

1501.1M8](/packages/bigcommerce-api)[pixelpeter/laravel5-woocommerce-api-client

Laravel 5 wrapper for the Woocommerce REST API

125103.4k](/packages/pixelpeter-laravel5-woocommerce-api-client)[highsidelabs/laravel-spapi

A Laravel wrapper for Amazon's Selling Partner API (via jlevers/selling-partner-api)

2133.4k](/packages/highsidelabs-laravel-spapi)[highsidelabs/walmart-api

A PHP client for Walmart's Marketplace, 1P Supplier, and Content Provider APIs.

308.0k](/packages/highsidelabs-walmart-api)

PHPackages © 2026

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