PHPackages                             survos/iiif-bundle - 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. survos/iiif-bundle

ActiveSymfony-bundle

survos/iiif-bundle
==================

PHP 8.4+ Symfony bundle for generating IIIF Presentation API 3.0 manifests

2.0.170(1mo ago)0107↓72%MITPHPPHP ^8.4CI failing

Since Mar 10Pushed 1mo agoCompare

[ Source](https://github.com/survos/iiif-bundle)[ Packagist](https://packagist.org/packages/survos/iiif-bundle)[ GitHub Sponsors](https://github.com/kbond)[ RSS](/packages/survos-iiif-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (39)Used By (0)

SurvosIiifBundle
================

[](#survosiiifbundle)

PHP 8.4+ Symfony bundle for generating IIIF Presentation API 3.0 manifests.

@todo: make sure it works with [https://manuscrits-france-angleterre.org/view3if/?target=https://gallica.bnf.fr/iiif/ark:/12148/bpt6k9907264/manifest.json&amp;page=2](https://manuscrits-france-angleterre.org/view3if/?target=https://gallica.bnf.fr/iiif/ark:/12148/bpt6k9907264/manifest.json&page=2)

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

[](#installation)

```
composer require survos/iiif-bundle
```

Quick Start
-----------

[](#quick-start)

```
use Survos\IiifBundle\Builder\ManifestBuilder;
use Survos\IiifBundle\Model\ImageService3;
use Survos\IiifBundle\Enum\ViewingDirection;
use Survos\IiifBundle\Enum\Behavior;

$builder = new ManifestBuilder('https://example.org/iiif/item-123/manifest');

$builder
    ->setLabel('en', 'Civil War Pension File — Pvt. James Wilson')
    ->setSummary('en', 'Pension application including affidavits and medical examination, 1892')
    ->addMetadata('en', 'Date', 'en', '1892')
    ->addMetadata('en', 'Creator', 'en', 'U.S. Pension Bureau')
    ->setRights('http://creativecommons.org/publicdomain/mark/1.0/')
    ->setRequiredStatement('en', 'Attribution', 'Courtesy of Carver 4-County Museum')
    ->setViewingDirection(ViewingDirection::LEFT_TO_RIGHT)
    ->setBehavior(Behavior::PAGED);

// Add pages as canvases
foreach ($pages as $i => $page) {
    $canvas = $builder->addCanvas(
        id: "https://example.org/iiif/item-123/canvas/p{$i}",
        label: "Page {$i}",
        width: $page->getWidth(),
        height: $page->getHeight(),
    );

    // Paint the image onto the canvas
    $canvas->addImage(
        annotationId: "https://example.org/iiif/item-123/canvas/p{$i}/anno/image",
        imageUrl: "https://s3.example.org/scans/item-123/page-{$i}.jpg",
        format: 'image/jpeg',
        width: $page->getWidth(),
        height: $page->getHeight(),
        service: new ImageService3(
            id: "https://iiif.example.org/image/item-123-page-{$i}",
            profile: 'level2'
        ),
    );

    // Add full-page OCR text as supplementing annotation
    $canvas->addSupplementingText(
        annotationId: "https://example.org/iiif/item-123/canvas/p{$i}/ocr/fulltext",
        text: $page->getOcrText(),
        language: 'en',
    );

    // Add word-level OCR annotations for search highlighting
    foreach ($page->getOcrWords() as $word) {
        $canvas->addWordAnnotation(
            annotationId: "https://example.org/iiif/item-123/canvas/p{$i}/ocr/word-" . $word->getId(),
            text: $word->getText(),
            language: 'en',
            x: $word->getX(),
            y: $word->getY(),
            width: $word->getWidth(),
            height: $word->getHeight(),
        );
    }
}

// Add Content Search service (Meilisearch-backed)
$builder->addSearchService('https://example.org/iiif/item-123/search');

// Serialize to JSON
$json = $builder->toJson();
$array = $builder->toArray();
```

Output Example
--------------

[](#output-example)

```
{
    "@context": "http://iiif.io/api/presentation/3/context.json",
    "id": "https://example.org/iiif/item-123/manifest",
    "type": "Manifest",
    "label": { "en": ["Civil War Pension File — Pvt. James Wilson"] },
    "summary": { "en": ["Pension application including affidavits and medical examination, 1892"] },
    "metadata": [
        { "label": { "en": ["Date"] }, "value": { "en": ["1892"] } },
        { "label": { "en": ["Creator"] }, "value": { "en": ["U.S. Pension Bureau"] } }
    ],
    "rights": "http://creativecommons.org/publicdomain/mark/1.0/",
    "requiredStatement": {
        "label": { "en": ["Attribution"] },
        "value": { "en": ["Courtesy of Carver 4-County Museum"] }
    },
    "items": [
        {
            "id": "https://example.org/iiif/item-123/canvas/p1",
            "type": "Canvas",
            "width": 3000,
            "height": 4000,
            "items": [
                {
                    "id": "https://example.org/iiif/item-123/canvas/p1/anno/image/page",
                    "type": "AnnotationPage",
                    "items": [
                        {
                            "id": "https://example.org/iiif/item-123/canvas/p1/anno/image",
                            "type": "Annotation",
                            "motivation": "painting",
                            "body": {
                                "id": "https://s3.example.org/scans/item-123/page-1.jpg",
                                "type": "Image",
                                "format": "image/jpeg",
                                "width": 3000,
                                "height": 4000,
                                "service": [
                                    {
                                        "id": "https://iiif.example.org/image/item-123-page-1",
                                        "type": "ImageService3",
                                        "profile": "level2"
                                    }
                                ]
                            },
                            "target": "https://example.org/iiif/item-123/canvas/p1"
                        }
                    ]
                }
            ],
            "annotations": [
                {
                    "id": "https://example.org/iiif/item-123/canvas/p1/ocr/fulltext/page",
                    "type": "AnnotationPage",
                    "items": [
                        {
                            "id": "https://example.org/iiif/item-123/canvas/p1/ocr/fulltext",
                            "type": "Annotation",
                            "motivation": "supplementing",
                            "body": {
                                "type": "TextualBody",
                                "value": "The full OCR text of page 1...",
                                "language": "en",
                                "format": "text/plain"
                            },
                            "target": "https://example.org/iiif/item-123/canvas/p1"
                        }
                    ]
                }
            ]
        }
    ],
    "service": [
        {
            "id": "https://example.org/iiif/item-123/search",
            "type": "SearchService2",
            "profile": "http://iiif.io/api/search/2/service"
        }
    ]
}
```

Model Classes
-------------

[](#model-classes)

All model classes implement `JsonSerializable` and use public properties with no boilerplate getters/setters.

### Core Resources

[](#core-resources)

- `AbstractResource` - Base class with common properties (id, type, label, summary, metadata, rights, etc.)
- `Manifest` - IIIF Manifest with items (Canvases) and structures (Ranges)
- `Collection` - Collection of Manifests or other Collections
- `Canvas` - A canvas that contains annotations (images, OCR text)
- `Range` - For table of contents / structural navigation (TOC)
- `AnnotationPage` - Container for Annotations
- `Annotation` - W3C Web Annotation with motivation, body, and target

### Content/Body Classes

[](#contentbody-classes)

- `ResourceItem` - Image, Video, Audio with id, type, format, service
- `TextualBody` - Inline text content (OCR text, descriptions)

### Supporting Classes

[](#supporting-classes)

- `Service` - IIIF Service reference
- `ImageService3` - Convenience class for Image Service 3
- `Thumbnail` - Simplified image reference
- `LabelMap` - Helper for language map construction
- `MetadataEntry` - label/value pair for metadata

### Enums

[](#enums)

- `Motivation` - painting, supplementing, commenting, tagging, etc.
- `ViewingDirection` - left-to-right, right-to-left, top-to-bottom, bottom-to-top
- `Behavior` - paged, continuous, individuals, auto-advance, etc.

Manual Construction
-------------------

[](#manual-construction)

You can also construct manifests manually without using the builder:

```
use Survos\IiifBundle\Model\Manifest;
use Survos\IiifBundle\Model\Canvas;
use Survos\IiifBundle\Model\AnnotationPage;
use Survos\IiifBundle\Model\Annotation;
use Survos\IiifBundle\Model\ResourceItem;
use Survos\IiifBundle\Model\LabelMap;
use Survos\IiifBundle\Enum\Motivation;

$manifest = Manifest::create('https://example.org/manifest');
$manifest->setLabel('en', 'My Document');

$canvas = Canvas::create(
    'https://example.org/canvas/1',
    LabelMap::create('en', 'Page 1'),
    3000,
    4000
);

$annotation = Annotation::createPainting(
    'https://example.org/annotation/1',
    ResourceItem::createImage('https://example.org/image1.jpg', 'image/jpeg', 3000, 4000),
    'https://example.org/canvas/1'
);

$annotationPage = AnnotationPage::create('https://example.org/annopage/1');
$annotationPage->addItem($annotation);
$canvas->addItem($annotationPage);

$manifest->addItem($canvas);

$json = json_encode(['@context' => 'http://iiif.io/api/presentation/3/context.json'] + $manifest->jsonSerialize(), JSON_PRETTY_PRINT);
```

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

[](#requirements)

- PHP 8.4+
- Symfony 7.3+ / 8.0+

References
----------

[](#references)

- [IIIF Presentation API 3.0](https://iiif.io/api/presentation/3.0/)
- [IIIF Cookbook Recipes](https://iiif.io/api/cookbook/)
- [iiif-prezi3 Python library](https://github.com/iiif-prezi/iiif-prezi3)

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance96

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

38

Last Release

50d ago

Major Versions

1.0.0 → 2.0.1262026-03-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/21b39551f92ed4143772c622f9e571589c5a72c96ab3c53fe67489ce0d83e806?d=identicon)[tacman1123](/maintainers/tacman1123)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/survos-iiif-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/survos-iiif-bundle/health.svg)](https://phpackages.com/packages/survos-iiif-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M646](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M385](/packages/shopware-core)[web-auth/webauthn-symfony-bundle

FIDO2/Webauthn Security Bundle For Symfony

63397.4k6](/packages/web-auth-webauthn-symfony-bundle)

PHPackages © 2026

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