PHPackages                             tudor/gls-api-php - 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. tudor/gls-api-php

ActiveLibrary[API Development](/categories/api)

tudor/gls-api-php
=================

MyGLS API PHP client for system integration

v1.0.1(1mo ago)13MITPHPPHP &gt;=8.4

Since May 26Pushed 1mo agoCompare

[ Source](https://github.com/tudorr89/gls-php-api-sdk)[ Packagist](https://packagist.org/packages/tudor/gls-api-php)[ RSS](/packages/tudor-gls-api-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

GLS API PHP
===========

[](#gls-api-php)

PHP 8.4+ client for the [MyGLS API](https://api.mygls.hu/) (v25.12.11) — label printing, parcel tracking, master data.

Supports 7 countries, all GLS service codes (incl. MMP, SHD), and ships with a Laravel service provider.

Installation
------------

[](#installation)

```
composer require tudor/gls-api-php
```

Requires PHP **&gt;= 8.4**.

Quick start
-----------

[](#quick-start)

```
use Gls\Api\GLSClient;
use Gls\Api\Enums\Country;
use Gls\Api\Enums\TypeOfPrinter;
use Gls\Api\Enums\ServiceCode;
use Gls\Api\Models\Address;
use Gls\Api\Models\Service;

$gls = new GLSClient(
    username: 'you@example.com',
    password: 'secret',
    country: Country::HUNGARY,
    testMode: true,
);

$pickup = new Address('My Company', 'Fő utca', '42', 'Budapest', '1132', 'HU');
$delivery = (new Address('Customer', 'Kossuth utca', '10', 'Debrecen', '4024', 'HU'))
    ->withContact('John', '+36209876543', 'john@email.com');

$parcel = $gls->parcel(123456, $pickup, $delivery)
    ->setClientReference('ORDER-001')
    ->setContent('Clothing')
    ->addService(Service::simple(ServiceCode::T12));

$response = $gls->printLabels([$parcel], typeOfPrinter: TypeOfPrinter::A4_2x2);

if ($response->isSuccessful()) {
    file_put_contents('labels.pdf', $response->getLabelsBytes());
    foreach ($response->getPrintLabelsInfoList() as $info) {
        echo "Parcel: {$info->getParcelNumber()}\n";
    }
}
```

### Laravel

[](#laravel)

```
php artisan vendor:publish --tag=gls-config
```

`.env`:

```
GLS_USERNAME=you@example.com
GLS_PASSWORD=secret
GLS_COUNTRY_CODE=HU
GLS_TEST_MODE=true

```

```
$gls = app(\Gls\Api\GLSClient::class); // or app('gls')
```

Countries
---------

[](#countries)

CountryEnumTestProductionCroatia`Country::CROATIA``api.test.mygls.hr``api.mygls.hr`Czechia`Country::CZECHIA``api.test.mygls.cz``api.mygls.cz`Hungary`Country::HUNGARY``api.test.mygls.hu``api.mygls.hu`Romania`Country::ROMANIA``api.test.mygls.ro``api.mygls.ro`Slovenia`Country::SLOVENIA``api.test.mygls.si``api.mygls.si`Slovakia`Country::SLOVAKIA``api.test.mygls.sk``api.mygls.sk`Serbia`Country::SERBIA``api.test.mygls.rs``api.mygls.rs`Switch country (clones, does not mutate):

```
$glsCz = $gls->withCountry(Country::CZECHIA)->withTestMode(false);
```

API methods
-----------

[](#api-methods)

### Parcel service

[](#parcel-service)

MethodDescription`prepareLabels($parcels)`Validate + persist`prepareLabelsV2($parcels)`Same, improved internals`getPrintedLabels($ids, $printer)`PDF from existing IDs`getPrintData($parcelIds, $parcels)`Printed package info`printLabels($parcels)`Prepare + Print in one call`printLabelsV2($parcels)`Versioned `PrintLabels_20251022` (PIN support)`deleteLabels($parcelIds)`Soft delete (capped at 50 IDs/request)`modifyCOD($amount, $id, $number)`Change COD amount`getParcelList(...)`Parcels by date range`getParcelStatuses($number)`Status history + optional POD`getParcelListStatuses($numbers)`Statuses for multiple parcels### Master data

[](#master-data)

MethodDescription`getDeliveryPoints($country, $lastUpdate)`ParcelShops, Lockers, Depots (GZIP-compressed)`getLocations($country, $lastUpdate)`Depots, hubs, routingServices &amp; parameters
-------------------------

[](#services--parameters)

Use `Gls\Api\Enums\ServiceCode`. GLS expects each parameter under the JSON key `{Code}Parameter` (e.g. `ADRParameter`, `INSParameter`) — the `Service` class produces this format automatically.

```
use Gls\Api\Models\ServiceParameters as P;

$parcel
    ->addService(Service::simple(ServiceCode::T12))
    ->addService(Service::withParameter(ServiceCode::INS,
        new P\ServiceParameterDecimal(50000)))
    ->addService(Service::withParameter(ServiceCode::PSD,
        new P\ServiceParameterStringInteger('2351-CSOMAGPONT')))
    ->addService(Service::withParameter(ServiceCode::SDS,
        P\ServiceParameterTimeRange::fromDates(
            new DateTimeImmutable('2026-05-27 12:00:00'),
            new DateTimeImmutable('2026-05-27 16:00:00')
        )));
```

CodeNameParameter`H24` (`24H`)24 Hour delivery—`ADR`Dangerous goods`ServiceParameterADR(...)``AOS`Addressee Only`ServiceParameterString(name)``COD`Cash on Deliveryuse `$parcel->setCod()``CS1`Contact Service`ServiceParameterString(phone)``DDS`Day Definite`ServiceParameterDateTime(date)``DPV`Declared Parcel Value`ServiceParameterStringDecimal(str, dec)``FDS`Flexible Delivery`ServiceParameterString(email)``FSS`Flexible SMS`ServiceParameterString(phone)` — requires FDS`INS`Insurance`ServiceParameterDecimal(value)``LRS`Locker Return`$parcel->setPickupType(2)` — HU only`MMP`Multi-parcel`ServiceParameterDecimal(value)``PRS`Pick &amp; Return— requires DeliveryAddress.ContactPhone`PSD`Parcel Shop Delivery`ServiceParameterStringInteger(psdId)``PSS`Pick &amp; Ship— requires DeliveryAddress.ContactPhone`SAT`Saturday`Service::withValue(ServiceCode::SAT, phone)``SDS`Scheduled Delivery`ServiceParameterTimeRange(from, to)``SHD`Shop Home Deliveryenables `Parcel::setFinalDeliveryAddress()``SM1`SMS`ServiceParameterString("phone|text")``SM2`SMS pre-advice`ServiceParameterString(phone)``SRS`Shop Return— HU, SI only`SZL`Document Return`ServiceParameterString(docId)` — max 15 chars`T09` / `T10` / `T12`Express—`TGS`Think Green—`XS`Exchange—`Parcel::validate()` (called automatically during JSON serialization) enforces:

- PRS/PSS require `DeliveryAddress.ContactPhone`
- `Count` must be 1–99
- `deleteLabels()` is capped at 50 IDs per request (enforced in `DeleteLabelsRequest`)

Printer types
-------------

[](#printer-types)

```
TypeOfPrinter::A4_2x2          // 4 labels per A4 page
TypeOfPrinter::A4_4x1          // 4 labels in a row
TypeOfPrinter::CONNECT
TypeOfPrinter::THERMO
TypeOfPrinter::THERMO_ZPL      // 203 DPI
TypeOfPrinter::THERMO_ZPL_300DPI
TypeOfPrinter::SHIP_IT_THERMO_PDF
TypeOfPrinter::SHIP_IT_THERMO_ZPL
```

Parcel dimensions
-----------------

[](#parcel-dimensions)

```
use Gls\Api\Models\ParcelProperty;
use Gls\Api\Enums\PackageType;

$parcel->addParcelProperty(new ParcelProperty(
    content: 'Clothing items',
    packageType: PackageType::BOX,
    height: 20, length: 30, width: 40, weight: 2.5,
));
```

Tracking
--------

[](#tracking)

```
$response = $gls->getParcelStatuses(12345678901, returnPOD: true);

foreach ($response->getParcelStatusList() as $status) {
    echo $status->getStatusDate()->format('Y-m-d H:i')
        . ': ' . $status->getStatusDescription() . "\n";
}

if ($podBytes = $response->getPodBytes()) {
    file_put_contents('pod.pdf', $podBytes);
}
```

Master data (incremental updates)
---------------------------------

[](#master-data-incremental-updates)

```
$response = $gls->getDeliveryPoints(country: Country::HUNGARY);
$lastUpdate = $response->getLastUpdateTime();

$response = $gls->getDeliveryPoints(country: Country::HUNGARY, lastUpdateTime: $lastUpdate);
if ($response->getIsChanged()) {
    $deliveryPoints = $response->getData();
    $lastUpdate = $response->getLastUpdateTime();
}
```

Error handling
--------------

[](#error-handling)

All responses expose `isSuccessful()`. Per-call errors are typed; transport-level failures throw `Gls\Api\Exceptions\GLSException`.

```
if (!$response->isSuccessful()) {
    foreach ($response->getPrintLabelsErrorList() as $error) {
        echo "Error {$error->getErrorCode()}: {$error->getErrorDescription()}\n";
    }
}
```

Tests
-----

[](#tests)

```
composer install
vendor/bin/phpunit
```

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance88

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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 ~0 days

Total

2

Last Release

59d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3405514?v=4)[Tudor Rusu](/maintainers/tudorr89)[@tudorr89](https://github.com/tudorr89)

---

Top Contributors

[![tudorr89](https://avatars.githubusercontent.com/u/3405514?v=4)](https://github.com/tudorr89 "tudorr89 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tudor-gls-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/tudor-gls-api-php/health.svg)](https://phpackages.com/packages/tudor-gls-api-php)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k18](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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