PHPackages                             bannerstop/planar - 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. bannerstop/planar

ActiveLibrary

bannerstop/planar
=================

PLANAR - Print Layout and Numerical Area Representation

1.0.0(today)00MITPHPPHP &gt;=7.4

Since Mar 24Pushed todayCompare

[ Source](https://github.com/bannerstop/planar)[ Packagist](https://packagist.org/packages/bannerstop/planar)[ RSS](/packages/bannerstop-planar/feed)WikiDiscussions main Synced today

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

PLANAR - Print Layout and Numerical Area Representation
=======================================================

[](#planar---print-layout-and-numerical-area-representation)

PLANAR is the deterministic, machine-readable specification of a print item's physical layout and constraints. It provides a standardized way to describe complex print products, including nested items, pages, bleeds, safety distances, and various overlays (marks, text, images).

Features
--------

[](#features)

- **Standardized Representation**: Uses a set of PHP interfaces and models to represent print items accurately.
- **Factory-Driven Creation**: Each model has a corresponding factory to decouple instantiation from usage.
- **Built-in Serialization**: Seamlessly convert PLANAR objects to JSON and back using Symfony Serializer.

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

[](#installation)

Install the package via Composer:

```
composer require bannerstop/planar
```

How to use it
-------------

[](#how-to-use-it)

### 1. Creating a Planar Instance

[](#1-creating-a-planar-instance)

You can create a PLANAR representation by manually instantiating models or, preferably, by using the provided factories.

#### Using Factories

[](#using-factories)

```
use Bannerstop\Planar\Factory\PlanarFactory;
use Bannerstop\Planar\Factory\ItemFactory;
use Bannerstop\Planar\Factory\OnlineDesignerFactory;
use Bannerstop\Planar\Factory\PageFactory;
use Bannerstop\Planar\Factory\BoxFactory;

// Initialize Factories
$planarFactory = new PlanarFactory();
$itemFactory = new ItemFactory();
$pageFactory = new PageFactory();
$boxFactory = new BoxFactory();
$onlineDesignerFactory = new OnlineDesignerFactory();

// Create a Page with bleed and safety distance
$bleed = $boxFactory->create(top: 5, right: 5, bottom: 5, left: 5); // 5mm all sides
$safetyDistance = $boxFactory->create(top: 10, right: 10, bottom: 10, left: 10);
$page = $pageFactory->create(
    width: 1000,
    height: 2000,
    label: 'Front',
    bleed: $bleed,
    safetyDistance: $safetyDistance
);

// Create an Item
$onlineDesigner = $onlineDesignerFactory->create(enabled: true, webProductId: 123, templateId: 456);
$item = $itemFactory->create(
    spark: 'spark_code_123',
    onlineDesigner: $onlineDesigner,
    itemNo: 1,
    sku: 'SKU-BANNER-1',
    name: 'Custom Vinyl Banner',
    quantity: 1,
    thumbnail: null,
    printable: true,
    subtotal: 49.99,
    currency: 'EUR',
    details: [], // Details
    pages: [$page] // Pages
);

// Final Planar Object
$planar = $planarFactory->create(items: [$item]);
```

### 2. JSON Example

[](#2-json-example)

The following JSON illustrates how a complex PLANAR object is represented:

```
{
    "subject": {
        "type": "order",
        "origin": "atlas",
        "id": "2123456"
    },
    "customer": {
        "name": "ACME Corp",
        "id": "100010"
    },
    "items": [
        {
            "itemNo": 1,
            "spark": "e3b0c442-98fc-11ee-b9d1-0242ac120002",
            "sku": "10001",
            "name": "PVC Frontlit",
            "quantity": 5,
            "thumbnail": {
                "url": "https://www.bannerstop.com/media/pvc-frontlit.png"
            },
            "printable": true,
            "onlineDesigner": {
                "enabled": true,
                "webProductId": 123,
                "templateId": 456,
                "omitPagesCustomization": false
            },
            "subtotal": 62.82,
            "currency": "EUR",
            "details": [
                {
                    "label": "Breite:",
                    "value": "123 cm"
                },
                {
                    "label": "Höhe:",
                    "value": "456 cm"
                },
                {
                    "label": "Variante:",
                    "value": "PVC Frontlit Premium"
                },
                {
                    "label": "Oben:",
                    "value": "Randverstärkung mit Ösen alle 100cm"
                },
                {
                    "label": "Unten:",
                    "value": "Randverstärkung mit Ösen alle 50cm"
                },
                {
                    "label": "Links:",
                    "value": "Hohlsaum 4cm flach"
                },
                {
                    "label": "Rechts:",
                    "value": "Randverstärkt"
                },
                {
                    "label": "Zubehör:",
                    "value": "Spannflex 50cm (30 Stk.)"
                }
            ],
            "pages": [
                {
                    "label": "Front",
                    "width": 1230,
                    "height": 4560,
                    "bleed": {
                        "top": 10,
                        "right": 10,
                        "bottom": 10,
                        "left": 10
                    },
                    "safetyDistance": {
                        "top": 5,
                        "right": 5,
                        "bottom": 5,
                        "left": 100
                    },
                    "overlays": [
                        {
                            "type": "rect",
                            "position": {
                                "x": 0,
                                "y": 0
                            },
                            "size": {
                                "width": 2000,
                                "height": 500,
                                "length": null,
                                "diameter": null,
                                "angle": 0,
                                "stroke": null
                            },
                            "color": {
                                "rgb": {
                                    "r": 0,
                                    "g": 0,
                                    "b": 255
                                },
                                "cmyk": {
                                    "c": 100,
                                    "m": 0,
                                    "y": 0,
                                    "k": 0
                                },
                                "spot": null
                            },
                            "fileName": null,
                            "overprint": false,
                            "renderIn3DPreview": false,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": true
                        },
                        {
                            "type": "line",
                            "position": {
                                "x": 50,
                                "y": 50
                            },
                            "size": {
                                "width": null,
                                "height": null,
                                "length": 1900,
                                "diameter": null,
                                "angle": 0,
                                "stroke": 5
                            },
                            "color": {
                                "rgb": {
                                    "r": 0,
                                    "g": 0,
                                    "b": 0
                                },
                                "cmyk": {
                                    "c": 0,
                                    "m": 0,
                                    "y": 0,
                                    "k": 100
                                },
                                "spot": null
                            },
                            "fileName": null,
                            "overprint": false,
                            "renderIn3DPreview": false,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": true
                        },
                        {
                            "type": "line",
                            "position": {
                                "x": 1950,
                                "y": 450
                            },
                            "size": {
                                "width": null,
                                "height": null,
                                "length": 1900,
                                "diameter": null,
                                "angle": 180,
                                "stroke": 5
                            },
                            "color": {
                                "rgb": {
                                    "r": 0,
                                    "g": 0,
                                    "b": 0
                                },
                                "cmyk": {
                                    "c": 0,
                                    "m": 0,
                                    "y": 0,
                                    "k": 100
                                },
                                "spot": null
                            },
                            "fileName": null,
                            "overprint": false,
                            "renderIn3DPreview": false,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": true
                        },
                        {
                            "type": "circle",
                            "position": {
                                "x": 1000,
                                "y": 250
                            },
                            "size": {
                                "width": null,
                                "height": null,
                                "length": null,
                                "diameter": 400,
                                "angle": 0,
                                "stroke": 1
                            },
                            "color": {
                                "rgb": {
                                    "r": 255,
                                    "g": 0,
                                    "b": 255
                                },
                                "cmyk": {
                                    "c": 100,
                                    "m": 100,
                                    "y": 0,
                                    "k": 0
                                },
                                "spot": null
                            },
                            "fileName": null,
                            "overprint": false,
                            "renderIn3DPreview": false,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": true
                        },
                        {
                            "type": "rect",
                            "position": {
                                "x": 300,
                                "y": 100
                            },
                            "size": {
                                "width": 200,
                                "height": 200,
                                "length": null,
                                "diameter": null,
                                "angle": 30,
                                "stroke": null
                            },
                            "color": {
                                "rgb": {
                                    "r": 255,
                                    "g": 0,
                                    "b": 0
                                },
                                "cmyk": {
                                    "c": 0,
                                    "m": 100,
                                    "y": 100,
                                    "k": 0
                                },
                                "spot": "Red Overprint"
                            },
                            "fileName": null,
                            "overprint": true,
                            "renderIn3DPreview": false,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": true
                        },
                        {
                            "type": "line",
                            "position": {
                                "x": 1500,
                                "y": 250
                            },
                            "size": {
                                "width": null,
                                "height": null,
                                "length": 200,
                                "diameter": null,
                                "angle": -45,
                                "stroke": 5
                            },
                            "color": {
                                "rgb": {
                                    "r": 255,
                                    "g": 0,
                                    "b": 0
                                },
                                "cmyk": {
                                    "c": 0,
                                    "m": 100,
                                    "y": 100,
                                    "k": 0
                                },
                                "spot": "Red Overprint"
                            },
                            "fileName": null,
                            "overprint": true,
                            "renderIn3DPreview": false,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": true
                        },
                        {
                            "type": "line",
                            "position": {
                                "x": 1500,
                                "y": 250
                            },
                            "size": {
                                "width": null,
                                "height": null,
                                "length": 200,
                                "diameter": null,
                                "angle": 45,
                                "stroke": 5
                            },
                            "color": {
                                "rgb": {
                                    "r": 255,
                                    "g": 0,
                                    "b": 0
                                },
                                "cmyk": {
                                    "c": 0,
                                    "m": 100,
                                    "y": 100,
                                    "k": 0
                                },
                                "spot": "Red Overprint"
                            },
                            "fileName": null,
                            "overprint": true,
                            "renderIn3DPreview": false,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": true
                        },
                        {
                            "type": "image",
                            "position": {
                                "x": 50,
                                "y": 50
                            },
                            "size": {
                                "width": 40,
                                "height": 40,
                                "length": null,
                                "diameter": null,
                                "angle": null,
                                "stroke": null
                            },
                            "color": null,
                            "fileName": "chrome_eyelet.png",
                            "overprint": null,
                            "renderIn3DPreview": true,
                            "renderOnCanvas": true,
                            "renderInReviewPdf": true,
                            "renderInPrintPdf": false
                        }
                    ]
                }
            ]
        }
    ]
}
```

### 4. Serialization and Deserialization

[](#4-serialization-and-deserialization)

The package provides a high-level service for serializing and deserializing PLANAR objects.

```
use Bannerstop\Planar\Service\PlanarSerializerService;

$serializerService = new PlanarSerializerService();

// Serialize to JSON
$json = $serializerService->serialize(planar: $planar);
echo $json;

// Deserialize from JSON
$deserializedPlanar = $serializerService->deserialize(json: $json);
```

### 5. Using Interfaces

[](#5-using-interfaces)

For maximum flexibility, always type-hint against the interfaces provided in `src/Contract/`.

```
use Bannerstop\Planar\Contract\PlanarInterface;
use Bannerstop\Planar\Contract\ItemInterface;

function processPrintOrder(PlanarInterface $planar) {
    foreach ($planar->getItems() as $item) {
        if ($item->isPrintable()) {
            echo "Processing printable item: " . $item->getName() . PHP_EOL;
        }
    }
}
```

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

[](#requirements)

- PHP `>= 7.4`
- `symfony/serializer`
- `symfony/property-access`
- `symfony/property-info`

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28f157ab08162319e7ad1983e00b7f3ae62df5ebd668f90e446593eea53fd0e4?d=identicon)[bannerstop](/maintainers/bannerstop)

![](https://www.gravatar.com/avatar/038e95175fdc7e8a07120c32db14e2ac75ab46a476fef9014cc19240c4d42a02?d=identicon)[mluex](/maintainers/mluex)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/bannerstop-planar/health.svg)

```
[![Health](https://phpackages.com/badges/bannerstop-planar/health.svg)](https://phpackages.com/packages/bannerstop-planar)
```

###  Alternatives

[jolicode/elastically

Opinionated Elastica based framework to bootstrap PHP and Elasticsearch implementations.

2571.7M1](/packages/jolicode-elastically)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50461.3k1](/packages/web-auth-webauthn-framework)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51756.1k74](/packages/symfony-ai-platform)

PHPackages © 2026

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