PHPackages                             omaghd/shipping-label - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. omaghd/shipping-label

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

omaghd/shipping-label
=====================

A Laravel package for generating shipping labels

v1.0.1(4mo ago)2445↓33.3%[1 PRs](https://github.com/omaghd/shipping-label/pulls)MITPHPPHP ^8.2CI passing

Since Jan 7Pushed 4mo agoCompare

[ Source](https://github.com/omaghd/shipping-label)[ Packagist](https://packagist.org/packages/omaghd/shipping-label)[ Docs](https://github.com/omaghd/shipping-label)[ GitHub Sponsors](https://github.com/OmaghD)[ RSS](/packages/omaghd-shipping-label/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (4)Used By (0)

A Laravel package for generating shipping labels
================================================

[](#a-laravel-package-for-generating-shipping-labels)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4b0ec97c1541eb0c1287c43f94572571c2a08411fd0ff8d7254c9277b3586e08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6d616768642f7368697070696e672d6c6162656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omaghd/shipping-label)[![GitHub Tests Action Status](https://camo.githubusercontent.com/9ab8b029928351caf32025e327c828c9ed94c104a4c77b7a30db08722bb8ce40/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f6d616768642f7368697070696e672d6c6162656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/omaghd/shipping-label/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/8c480f6d85ea25845d9a27a26ff0cd1050b68b6bbb38adfd88d76b9f409da717/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f6d616768642f7368697070696e672d6c6162656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/omaghd/shipping-label/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5d5a103e5d7c27b86bb7284240d1ef1718942b5be91bf83d87131b35024126b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6d616768642f7368697070696e672d6c6162656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omaghd/shipping-label)

Generate fast, precise PDF shipping labels with a flexbox-inspired layout engine. The package keeps the domain (elements and styling) separate from layout math and rendering, uses readonly value objects, and ships with a TCPDF driver pre-configured for internal fonts.

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

[](#installation)

You can install the package via composer:

```
composer require omaghd/shipping-label
```

Usage
-----

[](#usage)

```
use OmaghD\ShippingLabel\Label;
use OmaghD\ShippingLabel\Nodes\Column;
use OmaghD\ShippingLabel\Nodes\Row;
use OmaghD\ShippingLabel\Enums\BarcodeType;
use OmaghD\ShippingLabel\Enums\Unit;
use OmaghD\ShippingLabel\ValueObjects\Color;
use OmaghD\ShippingLabel\ValueObjects\Gutter;
use OmaghD\ShippingLabel\ValueObjects\Margin;
use OmaghD\ShippingLabel\ValueObjects\Padding;
use OmaghD\ShippingLabel\Config\LabelConfig;
use OmaghD\ShippingLabel\Config\RowConfig;
use OmaghD\ShippingLabel\Config\ColumnConfig;
use OmaghD\ShippingLabel\Config\TextStyleConfig;
use OmaghD\ShippingLabel\Elements\TextElement;
use OmaghD\ShippingLabel\Elements\ImageElement;
use OmaghD\ShippingLabel\Elements\SpacerElement;
use OmaghD\ShippingLabel\Elements\BulletsElement;
use OmaghD\ShippingLabel\Elements\RadioElement;
use OmaghD\ShippingLabel\Elements\BarcodeElement;
use OmaghD\ShippingLabel\Elements\QrCodeElement;
use OmaghD\ShippingLabel\Config\Elements\TextElementConfig;
use OmaghD\ShippingLabel\Config\Elements\ImageElementConfig;
use OmaghD\ShippingLabel\Config\Elements\SpacerElementConfig;
use OmaghD\ShippingLabel\Config\Elements\BulletsElementConfig;
use OmaghD\ShippingLabel\Config\Elements\RadioElementConfig;
use OmaghD\ShippingLabel\Config\Elements\BarcodeElementConfig;
use OmaghD\ShippingLabel\Config\Elements\QrCodeElementConfig;

Route::get('labels', function () {
    $label = Label::make()
        ->config(
            config: LabelConfig::make()
                ->square()
                ->unit(Unit::Mm)
                ->borderStroke(width: 0.1)
                ->borderColor(hexCode: Color::BLACK)
                ->margin(margin: Margin::uniform(5))
                ->gutter(gutter: Gutter::symmetric(2))
                ->defaultTextStyle(
                    config: TextStyleConfig::make()
                        ->fontSize(value: 8.0)
                        ->color(hexCode: Color::fromHex('#000000'))
                )
        );

    $orders = [
        ['id' => '101123456789', 'name' => 'Omar EL ATMANI', 'city' => 'Rabat', 'phone' => '06 23 28 02 12'],
        ['id' => '102123456789', 'name' => 'Sara ALAMI', 'city' => 'Casablanca', 'phone' => '06 11 22 33 44'],
        ['id' => '103123456789', 'name' => 'Ahmed BENNANI', 'city' => 'Fes', 'phone' => '06 55 66 77 88'],
        ['id' => '104123456789', 'name' => 'Karim TAZI', 'city' => 'Tangier', 'phone' => '06 99 88 77 66'],
        ['id' => '105123456789', 'name' => 'Ikram SADIKI', 'city' => 'Marrakech', 'phone' => '06 12 34 56 78'],
    ];

    foreach ($orders as $index => $order) {
        if ($index > 0) {
            $label->nextLabel();
        }

        $label
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 2.0)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: ImageElement::make()
                                    ->path(path: public_path('assets/images/logo.svg'))
                                    ->config(
                                        config: ImageElementConfig::make()
                                            ->height(value: 2.0)
                                            ->width(value: 20.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: $order['city'])
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->bold()
                                            ->fontSize(value: 8.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Hub ' . $order['city'])
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Amount')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->horizontalAlignCenter()
                                    )
                            )
                            ->addElement(
                                element: SpacerElement::make()
                                    ->config(
                                        config: SpacerElementConfig::make()
                                            ->height(value: 2.0)
                                    )
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: '$399')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->bold()
                                            ->fontSize(value: 10.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.5)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Client: **' . $order['name'] . '**')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Client Phone: **' . $order['phone'] . '**')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.5)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Address: **Street 1, ' . $order['city'] . '**')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 3.0)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignTop()
                                    ->horizontalAlignStart()
                            )
                            ->addElement(
                                element: BulletsElement::make()
                                    ->addItem(text: '1x : iPhone 17 Pro Max')
                                    ->addItem(text: '4x : Sony WH-1000XM4')
                                    ->addItem(text: '1x : Samsung Galaxy S21')
                                    ->config(
                                        config: BulletsElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->lineHeight(value: 3.5)
                                            ->horizontalAlignStart()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.0)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Store: Floral Shop')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Store Phone: 522 456 1234')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.0)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Store Address: Street 123')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.5)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'For customer service purposes, call us on: 522 456 7899')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.5)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: RadioElement::make()
                                    ->label(text: 'Open:')
                                    ->selectedLabel(text: 'Yes')
                                    ->unselectedLabel(text: 'No')
                                    ->selected(state: true)
                                    ->config(
                                        config: RadioElementConfig::make()
                                            ->verticalAlignMiddle()
                                            ->horizontalAlignStart()
                                    )
                            )
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: RadioElement::make()
                                    ->label(text: 'Try:')
                                    ->selectedLabel(text: 'Yes')
                                    ->unselectedLabel(text: 'No')
                                    ->selected(state: false)
                                    ->config(
                                        config: RadioElementConfig::make()
                                            ->verticalAlignMiddle()
                                            ->horizontalAlignStart()
                                    )
                            )
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: RadioElement::make()
                                    ->label(text: 'Exchange:')
                                    ->selectedLabel(text: 'Yes')
                                    ->unselectedLabel(text: 'No')
                                    ->selected(state: false)
                                    ->config(
                                        config: RadioElementConfig::make()
                                            ->verticalAlignMiddle()
                                            ->horizontalAlignStart()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.5)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Thank you for choosing us.')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->lineHeight(value: 1.2)
                                            ->maxLines(2)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 3.0)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 3)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: BarcodeElement::make()
                                    ->code(text: 'OM' . $order['id'])
                                    ->type(type: BarcodeType::C128)
                                    ->config(
                                        config: BarcodeElementConfig::make()
                                            ->height(value: 13.0)
                                    )
                            )
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: ImageElement::make()
                                    ->path(path: public_path('assets/images/image.png'))
                                    ->config(
                                        config: ImageElementConfig::make()
                                            ->height(value: 13.0)
                                            ->width(value: 13.0)
                                            ->fitCover()
                                    )
                            )
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->padding(padding: Padding::uniform(0))
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: QrCodeElement::make()
                                    ->content(text: 'https://omaghd.com/track/' . $order['id'])
                                    ->config(
                                        config: QrCodeElementConfig::make()
                                            ->fontSize(value: 13.0)
                                    )
                            )
                    )
            )
            ->addRow(
                row: Row::make()
                    ->config(
                        config: RowConfig::make()
                            ->height(ratio: 1.0)
                    )
                    ->addColumn(
                        column: Column::make()
                            ->config(
                                config: ColumnConfig::make()
                                    ->span(weight: 1)
                                    ->verticalAlignMiddle()
                                    ->horizontalAlignCenter()
                            )
                            ->addElement(
                                element: TextElement::make()
                                    ->content(text: 'Our shipping company is responsible for delivery only.')
                                    ->config(
                                        config: TextElementConfig::make()
                                            ->fontSize(value: 6.0)
                                            ->horizontalAlignCenter()
                                    )
                            )
                    )
            );
    }

    $label->render(filename: 'labels.pdf');
});
```

Testing
-------

[](#testing)

```
composer test
```

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)

- [OmaghD](https://github.com/OmaghD)

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance82

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

122d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/60360442?v=4)[OmaghD](/maintainers/omaghd)[@omaghd](https://github.com/omaghd)

---

Top Contributors

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

---

Tags

laravelphpshipping-labeltcpdflaravelshipping-labelOmaghD

###  Code Quality

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/omaghd-shipping-label/health.svg)

```
[![Health](https://phpackages.com/badges/omaghd-shipping-label/health.svg)](https://phpackages.com/packages/omaghd-shipping-label)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M626](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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