Search by

phil / glossary-bundle

phil

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

Homepage

Type:symfony-bundle

pkg:composer/phil/glossary-bundle

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0-alpha 2026-12-02 22:00 UTC

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 marked data-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-13 is linked whole before ISBN, whatever order the terms were created in.
  • Case when it matters: a term may compare its case, so BAnQ or NASA link while banq does not; accents always count.
  • Spellings to correct: a term lists the spellings an editor should not use (BANQ for BAnQ); 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>, and glossary_json_ld() describes it as a schema.org DefinedTermSet.
  • An audit: phil:glossary:audit lists 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.