PHPackages                             smart-dato/gls-shop-returns-customer-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. smart-dato/gls-shop-returns-customer-sdk

ActiveLibrary

smart-dato/gls-shop-returns-customer-sdk
========================================

GLS Shop Returns Customer API SDK for Laravel

v0.0.1(2mo ago)065↓53.8%[1 PRs](https://github.com/smart-dato/gls-shop-returns-customer-sdk/pulls)MITPHPPHP ^8.4CI passing

Since Mar 6Pushed 1mo agoCompare

[ Source](https://github.com/smart-dato/gls-shop-returns-customer-sdk)[ Packagist](https://packagist.org/packages/smart-dato/gls-shop-returns-customer-sdk)[ Docs](https://github.com/smart-dato/gls-shop-returns-customer-sdk)[ GitHub Sponsors](https://github.com/SmartDato)[ RSS](/packages/smart-dato-gls-shop-returns-customer-sdk/feed)WikiDiscussions main Synced 1mo ago

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

GLS Shop Returns Customer SDK
=============================

[](#gls-shop-returns-customer-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/27c97588795e6b4d2dbb3aa030c6aab669cbfa544d98e184e6fb6939b8be326e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d6172742d6461746f2f676c732d73686f702d72657475726e732d637573746f6d65722d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smart-dato/gls-shop-returns-customer-sdk)[![GitHub Tests Action Status](https://camo.githubusercontent.com/089f5055b9a74f77bd93a2247d04be37191dd27947aa301678b3f79f52ddba83/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736d6172742d6461746f2f676c732d73686f702d72657475726e732d637573746f6d65722d73646b2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/smart-dato/gls-shop-returns-customer-sdk/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/43227c15f1d67e9e899428ed723e0cd29fda8e20ba0a0494e06b7ba5a081c168/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736d6172742d6461746f2f676c732d73686f702d72657475726e732d637573746f6d65722d73646b2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/smart-dato/gls-shop-returns-customer-sdk/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/92426537637b2bca6a71615585fc87da3a8504c32ea85d9bdda25e8fd17873bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736d6172742d6461746f2f676c732d73686f702d72657475726e732d637573746f6d65722d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smart-dato/gls-shop-returns-customer-sdk)

Laravel package for integrating with the GLS Shop Returns Customer API v3. Supports generating return labels and parcel shop QR codes across European countries. Built on [Saloon 3.x](https://docs.saloon.dev) for HTTP and [Spatie Laravel Data 4.x](https://spatie.be/docs/laravel-data) for DTOs.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 11 or 12

Supported Countries
-------------------

[](#supported-countries)

Return labels can be generated from: AT, BE, BG, CH, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HR, HU, IE, IT, LT, LU, LV, NL, PL, PT, RO, SE, SI, SK.

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

[](#installation)

Install the package via Composer:

```
composer require smart-dato/gls-shop-returns-customer-sdk
```

Publish the config file:

```
php artisan vendor:publish --tag="gls-shop-returns-customer-sdk-config"
```

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env` file:

```
GLS_CLIENT_ID=your-client-id
GLS_CLIENT_SECRET=your-client-secret
GLS_APP_ID=your-app-id
GLS_ENVIRONMENT=sandbox
```

The published config file (`config/gls-shop-returns-customer-sdk.php`) contains all available options:

```
return [
    'environment' => env('GLS_ENVIRONMENT', 'sandbox'),  // sandbox, qas, production
    'app_id'      => env('GLS_APP_ID', 'sandbox'),
    'client_id'   => env('GLS_CLIENT_ID', ''),
    'client_secret' => env('GLS_CLIENT_SECRET', ''),
];
```

Available environments:

EnvironmentBase URL`sandbox``https://api-sandbox.gls-group.net/order-management/shop-returns/v3``qas``https://api-qas.gls-group.net/order-management/shop-returns/v3``production``https://api.gls-group.net/order-management/shop-returns/v3`> **Note:** In the sandbox environment, use `sandbox` as the `GLS_APP_ID`. Your real app ID is only for production.

Usage
-----

[](#usage)

Resolve the SDK from the container (or use the `GlsShopReturnsCustomer` facade):

```
use SmartDato\GlsShopReturnsCustomer\GlsShopReturnsCustomer;

$gls = app(GlsShopReturnsCustomer::class);
```

### Create a Return Order

[](#create-a-return-order)

```
use SmartDato\GlsShopReturnsCustomer\Data\CreateReturnOrderData;

$request = CreateReturnOrderData::from([
    'originalOrderReference' => 'ORDER-12345',
    'returnReason' => 'Product not as described',
    'sender' => [
        'personName' => 'Max Mustermann',
        'address' => [
            'street' => 'Musterstr. 1',
            'city' => 'Berlin',
            'zipCode' => '10115',
            'countryCode' => 'DE',
        ],
    ],
]);

$response = $gls->createReturnOrder($request);

$response->returnOrderId;          // "d137d614-ccc0-4d09-b956-9fc7483e7993"
$response->references->trackId;    // "YUNKGBSU"
$response->references->parcelId;   // "100002180461"
```

### Create a Return Order with Label (Base64)

[](#create-a-return-order-with-label-base64)

```
use SmartDato\GlsShopReturnsCustomer\Enums\LabelFormat;

$response = $gls->createReturnOrderWithLabel($request, LabelFormat::Pdf);

$response->returnOrderId;
$response->label->contentType;  // "application/pdf"
$response->label->content;      // Base64-encoded PDF
```

### Create a Return Order with Raw Label

[](#create-a-return-order-with-raw-label)

```
$rawPdf = $gls->createReturnOrderWithRawLabel($request, LabelFormat::Pdf);

// $rawPdf is the raw PDF binary content
file_put_contents('return-label.pdf', $rawPdf);
```

### Create a Return Order with QR Code

[](#create-a-return-order-with-qr-code)

For parcel shop drop-off (supported in AT, BE, DE, DK, LU):

```
$response = $gls->createReturnOrderWithQrCode($request);

$response->parcelShopQrCode->contentType;  // "application/pdf"
$response->parcelShopQrCode->content;      // Base64-encoded QR code
```

### Retrieve a Label for an Existing Order

[](#retrieve-a-label-for-an-existing-order)

```
use SmartDato\GlsShopReturnsCustomer\Enums\LabelType;
use SmartDato\GlsShopReturnsCustomer\Enums\LabelFormat;

// Get label as JSON (base64)
$response = $gls->getLabel(
    returnOrderId: 'd137d614-ccc0-4d09-b956-9fc7483e7993',
    labelType: LabelType::Label,
    labelFormat: LabelFormat::Pdf,
);

// Get raw label binary
$rawLabel = $gls->getRawLabel(
    returnOrderId: 'd137d614-ccc0-4d09-b956-9fc7483e7993',
    labelType: LabelType::Label,
    labelFormat: LabelFormat::Pdf,
);
```

### Optional Fields

[](#optional-fields)

```
$request = CreateReturnOrderData::from([
    'originalOrderReference' => 'ORDER-12345',
    'returnReason' => 'Wrong size',
    'sender' => [
        'personName' => 'Maria Garcia',
        'companyName' => 'Garcia SL',
        'email' => 'maria@example.com',  // Required for ES, FR, IT, SE
        'address' => [
            'street' => 'Calle Mayor 1',
            'city' => 'Madrid',
            'zipCode' => '28001',
            'countryCode' => 'ES',
        ],
    ],
    'parcel' => [
        'weight' => 2.5,  // kg, defaults to 1.5
    ],
    'options' => [
        'languageCode' => 'es',
        'confirmationMail' => [
            'sendTo' => ['customer@example.com'],
            'attachments' => [
                'label' => ['include' => true],
                'parcelShopQrCode' => ['include' => true],
            ],
        ],
        'label' => [
            'layout' => 'A6',  // A4 (default) or A6
        ],
    ],
    'additionalReferences' => [
        'broker' => '#BROKER123#',
        'nationalContactId' => '111aaagZ0A',  // FR only
    ],
]);
```

### Using the Facade

[](#using-the-facade)

```
use SmartDato\GlsShopReturnsCustomer\Facades\GlsShopReturnsCustomer;

$response = GlsShopReturnsCustomer::createReturnOrder($request);
$label = GlsShopReturnsCustomer::createReturnOrderWithLabel($request, LabelFormat::Pdf);
$rawPdf = GlsShopReturnsCustomer::createReturnOrderWithRawLabel($request, LabelFormat::Pdf);
```

Available Enums
---------------

[](#available-enums)

```
use SmartDato\GlsShopReturnsCustomer\Enums\Environment;    // Sandbox, Qas, Production
use SmartDato\GlsShopReturnsCustomer\Enums\LabelFormat;     // Pdf, Zpl, Png
use SmartDato\GlsShopReturnsCustomer\Enums\LabelType;       // Label, ParcelShopQrCode
use SmartDato\GlsShopReturnsCustomer\Enums\LabelDpi;        // Dpi152, Dpi203, Dpi300
use SmartDato\GlsShopReturnsCustomer\Enums\LabelLayout;     // A4, A6
use SmartDato\GlsShopReturnsCustomer\Enums\LanguageCode;    // German, English, French, Spanish, ...
```

Error Handling
--------------

[](#error-handling)

API errors are thrown as `GlsApiException`:

```
use SmartDato\GlsShopReturnsCustomer\Exceptions\GlsApiException;

try {
    $response = $gls->createReturnOrder($request);
} catch (GlsApiException $e) {
    $e->getMessage();              // Error message from the API
    $e->getCode();                 // HTTP status code (400, 401, 403, 429, etc.)
    $e->errors;                    // Array of ErrorData objects
    $e->errors[0]->type;           // "400-UNKNOWN-KEY"
    $e->errors[0]->fieldName;      // "layout"
    $e->errors[0]->fieldValue;     // "XYZ"
    $e->errors[0]->message;        // "must be one of [A4, A6]"
}
```

Testing
-------

[](#testing)

```
composer test             # Run tests
composer analyse          # Static analysis (PHPStan level 5)
composer format           # Code style (Laravel Pint)
composer test-coverage    # Tests with coverage report
```

### Sandbox Integration Tests

[](#sandbox-integration-tests)

To run tests against the real GLS sandbox API:

1. Copy `.env.testing.example` to `.env.testing` and fill in your credentials
2. Run: `vendor/bin/pest --group=sandbox`

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [SmartDato](https://github.com/smart-dato)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance88

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

68d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3006db55caec62526937fa2d941da32fc5e69e2ca86a52e87c8046da5958d82?d=identicon)[smart-dato](/maintainers/smart-dato)

---

Top Contributors

[![tschigo](https://avatars.githubusercontent.com/u/344100?v=4)](https://github.com/tschigo "tschigo (3 commits)")

---

Tags

laravelSmartDatogls-shop-returns-customer-sdk

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/smart-dato-gls-shop-returns-customer-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/smart-dato-gls-shop-returns-customer-sdk/health.svg)](https://phpackages.com/packages/smart-dato-gls-shop-returns-customer-sdk)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

188.5k](/packages/tarfin-labs-event-machine)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)

PHPackages © 2026

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