PHPackages                             debach/typography-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. debach/typography-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

debach/typography-bundle
========================

Integrates the mundschenk-at/php-typography package into Symfony applications.

v4.0.0(5y ago)2113MITPHP

Since Feb 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/debach/typography-bundle)[ Packagist](https://packagist.org/packages/debach/typography-bundle)[ RSS](/packages/debach-typography-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

TypographyBundle
================

[](#typographybundle)

The TypographyBundle provides easy access to the [PHP-Typography](https://github.com/mundschenk-at/php-typography) library for Symfony applications. PHP-Typography is n actively maintained fork of the discontinued [KINGdesk PHP Typography](http://kingdesk.com/projects/php-typography/) (seems to be no longer reachable as of 2020).

How to use the TypographyBundle
-------------------------------

[](#how-to-use-the-typographybundle)

To enhance the typography of your HTML inside a Twig template, you can use the the filter `{{ someText | typography }}` and the tag `{% typography %}`, i.e.

```
{# template.html.twig #}
{% typography %}
    Welcome to "The 'one &amp; only' Blog"

        This is my personal website. I'm glad you found it - that makes you the 1st visitor. I estimate that about 6/7 of the future visitors will be typography-lovers...

    Wikipedia about William Shakespeare

    The following paragraph might look better with hyphenation.

        William Shakespeare (bapt. 26 April 1564 – 23 April 1616) was an English poet, playwright, and actor, widely regarded as the greatest writer in the English language and the world's greatest dramatist. He is often called England's national poet and the "Bard of Avon" (or simply "the Bard"). His extant works, including collaborations, consist of some 39 plays, 154 sonnets, two long narrative poems, and a few other verses, some of uncertain authorship. His plays have been translated into every major living language and are performed more often than those of any other playwright.

{% endtypography %}

```

The library won’t touch HTML tags and will process only plain text between tags. The output of the above Twig snippet would be – beware the soft hyphens are invisible, but will cause long words to be hyphenated:

```
Wel­come to ​“The ​‘one &amp;&nbsp;only’ Blog”
This is my per­son­al web­site. I’m glad you found it — that makes you the 1st vis­i­tor. I&nbsp;esti­mate that about 6⁄7 of the future vis­i­tors will be typography-lovers…
Wikipedia about William Shakespeare
The fol­low­ing para­graph might look bet­ter with hyphenation.
William Shake­speare (bapt. 26 April 1564 – 23 April 1616) was an Eng­lish poet, play­wright, and actor, wide­ly regard­ed as the great­est writer in the Eng­lish lan­guage and the world’s great­est drama­tist. He is often called Eng­land’s nation­al poet and the ​“Bard of Avon” (or sim­ply ​“the Bard”). His extant works, includ­ing col­lab­o­ra­tions, con­sist of some 39 plays, 154 son­nets, two long nar­ra­tive poems, and a&nbsp;few oth­er vers­es, some of uncer­tain author­ship. His plays have been trans­lat­ed into every major liv­ing lan­guage and are per­formed more often than those of any oth­er playwright.

```

When you have a single string or Twig variable that you want to enhance, use the filter instead:

```
{{ "About... Me" | typography }}
{{ twig_variable | typography }}

```

What the TypographyBundle does
------------------------------

[](#what-the-typographybundle-does)

The TypographyBundle enhances the typography of the text in your Twig templates. The following table shows *some* examples of HTML texts before and after processing.

   Before After Explanation     explanation ex&amp;shy;pla&amp;shy;na&amp;shy;tion Robust hyphenation with soft hyphens `&shy;`. The browser will hyphenate words automatically based on the current line width.   I'm waiting for "Peter" I’m waiting for “Peter” Use correct quotes and apostrophes   ... … Use the ellipses symbol   A flock of sparrows - some of them juveniles - alighted and sang. A flock of sparrows — some of them juveniles — alighted and sang. Use an em-dash instead of a hypen   14-20 men 14–20 men Use an en-dash instead of a hypen in ranges  For more examples, I used to refer to the former [project homepage](http://kingdesk.com/projects/php-typography/), but that doesn’t seem to exist any longer. There are a couple of examples over at [the new repository.](https://github.com/mundschenk-at/php-typography)

Configuration
-------------

[](#configuration)

You can configure which instance of `PHP_Typography\Settings` is used by `PHP_Typography\PHP_Typography` in this bundle. Just overwrite the service definition of `debach_typography.php_typography_settings` and use the `calls` list to configure it:

```
# Acme/DemoBundle/Resources/config/service.yml
debach_typography.php_typography_settings:
    class: PHP_Typography\Settings
    calls:
        - [set_smart_diacritics, [false]]
        - [set_style_initial_quotes, [false]]
        - [set_hyphenation, [true]]
        - [set_hyphenation_language, ["%locale%"]]

```

The configuration given above is the default configuration for the `PhpTypography` instance used by the bundle. See the [KINGdesk site](http://kingdesk.com/projects/php-typography-documentation/) for a documentation of the available configuration setters.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

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 ~93 days

Recently: every ~117 days

Total

6

Last Release

2181d ago

Major Versions

v1.0.0 → v2.0.02019-02-14

v2.0.1 → v3.0.02019-03-15

v3.0.1 → v4.0.02020-05-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1ceabd36f4834f31cd17699359be7c2abf800ad9a598017a32372f54b0193b4?d=identicon)[debach](/maintainers/debach)

---

Top Contributors

[![debach](https://avatars.githubusercontent.com/u/454897?v=4)](https://github.com/debach "debach (10 commits)")

### Embed Badge

![Health badge](/badges/debach-typography-bundle/health.svg)

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

###  Alternatives

[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)

PHPackages © 2026

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