phil / licensing-bundle
Credit every work under its license, from Creative Commons to the ORC and OGL: attribution pages, compliance checks and an export guard before printing.
Package info
github.com/parler-haut-interagir-librement/licensing-bundle
Type:symfony-bundle
pkg:composer/phil/licensing-bundle
Requires
- php: >=8.5
- ext-mbstring: *
- doctrine/orm: ^3.7
- phil/url: ^0.1.4@dev
- psr/event-dispatcher: ^1.0
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/event-dispatcher: ^8.2
- symfony/translation-contracts: ^3.6
- symfony/uid: ^8.2
- twig/twig: ^3.21
Requires (Dev)
- doctrine/dbal: ^4.5
- doctrine/doctrine-bundle: ^3.3
- doctrine/persistence: ^4.1
- phil/paged-media: ^0.1@dev
- phil/paged-media-bundle: ^0.1.1@dev
- phil/structured-data: ^0.1.1@dev
- phil/ujo: ^0.1.3@dev
- phpunit/phpunit: ^13.4
- psr/log: ^3.0
- roave/security-advisories: dev-latest
- symfony/form: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/http-foundation: ^8.2
- symfony/http-kernel: ^8.2
- symfony/options-resolver: ^8.2
- symfony/security-bundle: ^8.2
- symfony/security-core: ^8.2
- symfony/translation: ^8.2
- symfony/twig-bridge: ^8.2
- symfony/twig-bundle: ^8.2
- symfony/validator: ^8.2
- symfony/yaml: ^8.2
Suggests
- doctrine/doctrine-bundle: For the declarations kept in the table phil_licensing_declaration
- phil/paged-media-bundle: For the export guard run before each print that names its work
- phil/structured-data: For the licensing of a work as JSON-LD
- phil/ujo: For the license and attribution page as a UJO (Universal JSON Output) document
- symfony/form: For the attribution form and the license finder in steps, with symfony/validator
- symfony/security-bundle: For the voter PHIL_LICENSING_EXPORT
- symfony/translation: For the page and the messages in English and French
- symfony/twig-bundle: For the license and attribution page as HTML
- symfony/validator: For the checks of the attribution form and of the license finder
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-21 03:03:44 UTC
README
The license a work is published under, what that license asks, and the page that gives it: declared, checked, and shown in HTML, UJO (Universal JSON Output) or JSON-LD.
phil/licensing-bundle keeps the license of a work or a digital product — a book, a set of rules, a product of a shop — and the credit of every resource the work uses: the images, the maps, the fonts, the text sources such as a system reference document. Its catalog knows the ORC License, the six Creative Commons 4.0 licenses, CC0 1.0, the Open Game License 1.0a and custom terms, each with what it requires: the credit of the creators, a notice naming the license, its full text, the copyright notices, share-alike, the Reserved Material, the Product Identity, the designation of the open content. An application adds its own licenses.
It is for any Symfony application that publishes works built on licensed material and must say so: attach a
LicenseDeclaration to the subject by its type and identifier, list the attributions, and the bundle generates the
license and attribution page, checks the declaration against the licenses, and refuses an export that has no license
or misses what a license requires — with the strict printing, a print that names no work too. An attribution form asks
for the changes a license wants indicated, and a license finder, in steps and without JavaScript, chooses the license
from what the author allows or writes custom terms.
The obligations of each license are summarized from its official text, never quoted; the bundle ships no license text. When a license asks for its text to go with the work, the declaration holds it, as the application provides it.
Status
| Part | State |
|---|---|
| The catalog: ORC, CC BY, BY-SA, BY-NC, BY-NC-SA, BY-ND and BY-NC-ND 4.0, CC0 1.0, OGL 1.0a, custom terms, licenses of the application | Implemented and tested |
LicenseDeclaration, attached to any subject, with its attributions, in the table phil_licensing_declaration |
Implemented and tested |
LicenseCompliance, the violations of a declaration |
Implemented and tested |
ExportGuard, its ExportChecking event and the voter PHIL_LICENSING_EXPORT |
Implemented and tested |
The export guard before each print of phil/paged-media-bundle that names its work, unlicensed subjects |
Implemented and tested |
| The strict printing, off by default: a print that names no work refused | Implemented and tested |
AttributionType, the changes required by the license, "No modifications" |
Implemented and tested |
LicenseFinder, the decision tree, and its custom terms |
Implemented and tested |
LicenseFinderType, the license finder in steps on the form flow of Symfony |
Implemented and tested |
| Community content programs: a license offered to creators, revenue sharing | Not started (Scope) |
| The license and attribution page as an HTML fragment, in English and French | Implemented and tested |
The page as a UJO (Universal JSON Output) document, with phil/ujo |
Implemented and tested |
The licensing of a work as JSON-LD, with phil/structured-data |
Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, registering, the table, the optional packages. |
| Configuration | Every key, the licenses of the application, the services. |
| Licenses | The catalog, what each license requires and where it comes from. |
| Declarations | Declaring a license, the attributions, the limits, Doctrine. |
| The attribution page | The HTML fragment, the Twig functions, the UJO document, the JSON-LD. |
| Compliance | The checks, the violations, the export guard, its event and its voter. |
| Printing | The guard of the prints, the unlicensed subjects, the strict printing. |
| The attribution form | The credit of a resource as a form, the changes and "No modifications". |
| The license finder | The decision tree, the custom terms, the form in steps, the templates. |
| Scope | What the bundle does, and what stays out of it. |
| Extension points | What an application implements, replaces or listens to. |
| Testing | How the bundle is tested, and how to test an application with it. |
| Reference | Every type of the bundle. |
Quick start
composer require phil/licensing-bundle
use Phil\LicensingBundle\Domain\Catalog\LicenseCatalog; use Phil\LicensingBundle\Domain\Catalog\ResourceKind; use Phil\LicensingBundle\Domain\Model\LicenseDeclaration; use Phil\LicensingBundle\Domain\ValueObject\Attribution; use Phil\LicensingBundle\Domain\ValueObject\SubjectReference; $declaration = LicenseDeclaration::declare(SubjectReference::of('book', $book->getId()), $catalog->get(LicenseCatalog::ORC), $now); $declaration->describe('© 2026 Example Press', 'The names, maps and art of the setting.', null, null, $now); $declaration->attribute([ Attribution::of(ResourceKind::Text, 'Example Reference Document', LicenseCatalog::ORC, 'Example Games'), Attribution::of(ResourceKind::Image, 'Cover', LicenseCatalog::CC_BY, 'Jane Doe', 'https://example.com/cover', '© 2024 Jane Doe', 'Cropped'), ], $now); $declarations->add($declaration); // LicenseDeclarationRepository; the entity manager flushes it $exportGuard->assertExportable(SubjectReference::of('book', $book->getId())); // ExportBlocked otherwise
{{ phil_licensing_attribution(book) }} {# a Licensable, a SubjectReference or a declaration #}
Requirements
PHP 8.5 or later with ext-mbstring, phil/url, Symfony 8.2 or later, Doctrine ORM 3.7 and Twig 3.21;
DoctrineBundle for the table, TwigBundle for the page, symfony/translation for English and French, phil/ujo for
the UJO document, phil/structured-data for the JSON-LD, SecurityBundle for the voter, phil/paged-media-bundle for
the guard of the prints, symfony/form and symfony/validator for the forms.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.