phil / glossary-bundle
Explain your jargon where readers meet it: a glossary per language whose terms link to their definitions in your Symfony texts, and spellings to correct.
Package info
github.com/parler-haut-interagir-librement/glossary-bundle
Type:symfony-bundle
pkg:composer/phil/glossary-bundle
Requires
- php: >=8.5
- ext-intl: *
- ext-mbstring: *
- doctrine/orm: ^3.8
- phil/url: ^0.1.2@dev
- psr/clock: ^1.0
- symfony/cache-contracts: ^3.8
- symfony/clock: ^8.2
- symfony/config: ^8.2
- symfony/console: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/routing: ^8.2
- symfony/service-contracts: ^3.8
- symfony/string: ^8.2
- symfony/translation-contracts: ^3.8
- symfony/uid: ^8.2
Requires (Dev)
- doctrine/dbal: ^4.6
- doctrine/doctrine-bundle: ^3.4
- doctrine/event-manager: ^2.1
- phpunit/phpunit: ^13.4
- psr/event-dispatcher: ^1.0
- psr/log: ^3.0
- symfony/cache: ^8.2
- symfony/event-dispatcher: ^8.2
- symfony/event-dispatcher-contracts: ^3.8
- symfony/framework-bundle: ^8.2
- symfony/http-foundation: ^8.2
- symfony/http-kernel: ^8.2
- symfony/twig-bundle: ^8.2
- twig/twig: ^3.31.1
Suggests
- symfony/twig-bundle: For the glossary_link filter, the glossary functions and the page template
- twig/twig: For the glossary_link filter, the glossary functions and the page template
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-03 01:33:15 UTC
README
Explain your jargon where readers meet it: a glossary per language whose terms link to their definitions in your Symfony texts, and spellings to correct.
phil/glossary-bundle is a Symfony bundle. A site keeps one glossary per locale — or several, as default and
rules — and every article, lesson or page links the terms it uses to their definitions on the glossary page.
- First occurrence only: a term is linked the first time it appears in a text, never in headings, links, code,
preformatted text, form controls,
<abbr>or<dfn>, nor inside an element markeddata-glossary="off". The spelling written in the text is kept, its case and entities included. - Synonyms, plurals and abbreviations: each term has its label and other spellings that link to it; an
abbreviation carries its expansion, rendered as
<abbr title="…">inside the link. - The longest spelling wins:
ISBN-13is linked whole beforeISBN, whatever order the terms were created in. - Case when it matters: a term may compare its case, so
BAnQorNASAlink whilebanqdoes not; accents always count. - Spellings to correct: a term lists the spellings an editor should not use (
BANQforBAnQ); a draft gets proposals with their offsets, never in quotations, and the accepted ones are applied. - A page that works without a mouse: a link goes to the term's anchor on the glossary page — a tooltip is never
the only way to the definition. The page template marks each term with
<dfn>, andglossary_json_ld()describes it as a schema.orgDefinedTermSet. - An audit:
phil:glossary:auditlists the spellings two terms share, before texts link to the wrong one. - Bounded and fast: the spellings are indexed by their first word, so a glossary of 2,000 terms links a 6 KB article in under a millisecond; texts, terms, spellings and links all have limits. The compiled glossary sits in a cache pool, and the services keep nothing from one request to the next.
Status
| Part | State |
|---|---|
| Terms in Doctrine, their table prefix, the memory store | Implemented and tested |
| Linking in HTML, first occurrence, skipped elements, limits | Implemented and tested, fuzzed |
| Spellings to correct, proposals and their application | Implemented and tested, fuzzed |
| Glossary page template, Twig filter and functions, JSON-LD | Implemented and tested |
| Cache pool, invalidation on change, worker reset | Implemented and tested |
| Audit command | Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing, the table, a first term. |
| Configuration | Every option, with an example. |
| Terms | What a term holds, its spellings and limits, and how to write terms. |
| Linking | How texts are read and linked, and what is never read. |
| Spellings to correct | Proposals for a draft, and applying the accepted ones. |
| Twig and the glossary page | The filter, the functions, the page template and its JSON-LD. |
| Extension points | The services to replace, the events and templates, and when they are stable. |
| Testing | The bundle's tests, the fuzz target and the benchmark. |
| Reference | Every class and service of the bundle. |
Quick start
// config/bundles.php Phil\GlossaryBundle\PhilGlossaryBundle::class => ['all' => true],
# config/packages/phil_glossary.yaml phil_glossary: page: route: app_glossary locale_parameter: _locale
use Phil\GlossaryBundle\Application\Terms; use Phil\GlossaryBundle\Domain\ValueObject\GlossaryEntry; use Phil\GlossaryBundle\Domain\ValueObject\GlossaryScope; $terms->define(GlossaryScope::of('default', 'en'), GlossaryEntry::create( slug: null, // derived from the label: "isbn" label: 'ISBN', definition: 'The identifier of a book.', forms: ['ISBNs'], expansion: 'International Standard Book Number', ));
{{ article.body|glossary_link }}
Requirements
PHP 8.5 or later with the intl extension, and Symfony 8.2 or later; Doctrine ORM 3.8 for the stored terms; Twig for the filter and the page.
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.