PHPackages                             nystudio107/php-typography - 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. nystudio107/php-typography

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

nystudio107/php-typography
==========================

The KINGdesk PHP Typography library improves typography on the web.

1.0.0(8y ago)021GPL-2.0PHPPHP &gt;=5.3.0

Since Oct 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nystudio107/php-typography)[ Packagist](https://packagist.org/packages/nystudio107/php-typography)[ RSS](/packages/nystudio107-php-typography/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

PhpTypography
=============

[](#phptypography)

PhpTypography is based on the [PHP Typography library](http://kingdesk.com/projects/php-tyography/) by KINGdesk. It is extended to support the PSR-0 autoloading standard.

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

[](#installation)

Install PhpTypography with [composer](https://getcomposer.org) via

```
composer require debach/php-typography:dev-master
composer install

```

and then use the class like

```
$html       = '...';
$typography = new Debach\PhpTypography\PhpTypography();
$prettyHtml = $typography->process($html);

```

What PhpTypography does
-----------------------

[](#what-phptypography-does)

PhpTypography enhances the typography of the text on your web pages. 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. This is especially useful where the line width is rather small, for example in multi-column texts (CSS property `column-count`).   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   `Acme Corporation & Partners` `Acme Corporation & Partners` Ampersands symbols are marked up so that you can choose a different font for them and make them look beatiful. Search the web for “ampersand font” as a start.  For more examples, see the [project homepage](http://kingdesk.com/projects/php-typography/).

How to use PhpTypography
------------------------

[](#how-to-use-phptypography)

Construct an instance `$typography` of `Debach\PhpTypography\PhpTypography` and call `$typography->process($html)` on it with the HTML text `$html` you want to process:

```
$html       = 'I\'m waiting for "Peter"...';
$typography = new Debach\PhpTypography\PhpTypography();
$prettyHtml = $typography->process($html);
echo $prettyHtml;

```

The above code will print (soft hyphens not shown)

```
I’m waiting for “Peter”…

```

By the way, if you’re using the full-stack Symfony framework and Twig, there is also the [TypographyBundle](https://github.com/debach/typography-bundle) which comes with nice little helpers such as the `{% typography %}` tag and the `{{ text|typography }}` filter.

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

[](#configuration)

A thorough explanation of the configuration can be found at the [KINGdesk homepage](http://kingdesk.com/projects/php-typography-documentation/).

Hyphenation depends on the language, which can be set with `set_hyphenation_language($languageCode)`. For example, to set the hyphenation language to French or German, call

```
$typography->set_hyphenation_language('fr'); // set to French
$typography->set_hyphenation_language('de'); // set to German

```

The default language is American English. Refer to the filenames in the `lang/` directory for an overview of available languages.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.2% 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

Unknown

Total

1

Last Release

3133d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7570798?v=4)[Andrew Welch](/maintainers/khalwat)[@khalwat](https://github.com/khalwat)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/nystudio107-php-typography/health.svg)

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

###  Alternatives

[flyingluscas/viacep-php

ViaCEP PHP SDK

3640.2k](/packages/flyingluscas-viacep-php)[chasegiunta/craft-jason

A field type for displaying &amp; editing JSON data.

1534.3k](/packages/chasegiunta-craft-jason)

PHPackages © 2026

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