mundschenk-at/php-typography
A PHP library for improving your web typography
Maintainers
v6.7.0
2022-11-14 22:30 UTC
Requires
- php: >=7.4.0
- ext-mbstring: *
- ext-pcre: *
- masterminds/html5: ^2.5.0
Requires (Dev)
- ext-curl: *
- brain/monkey: ^2.2.0
- dealerdirect/phpcodesniffer-composer-installer: ^0.7
- mundschenk-at/phpunit-cross-version: dev-master
- phpbench/phpbench: ^0.17||^1.0@dev
- phpcompatibility/php-compatibility: ^9.0
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.9
- phpstan/phpstan-mockery: ^1.1
- phpunit/phpunit: 5.*||6.*||7.*|8.*|9.*
- squizlabs/php_codesniffer: ^3
- wp-coding-standards/wpcs: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
GPL-2.0-or-later 6b0414811f42e53e101f5ea5a8023c63eafd3dcb
- Peter Putzer <github.woop@mundschenk.at>
- Jeffrey D. King <jeff.king.woop@weathersource.com>
This package is auto-updated.
Last update: 2026-06-15 23:45:49 UTC
README
๐ Build Status
๐ Latest Stable Version
๐ Quality Gate Status
๐ Coverage
๐ License
A PHP library for improving your web typography:
- Hyphenationโโโover 50 languages supported
- Space control, including:
- widow protection
- gluing values to units
- forced internal wrapping of long URLs & email addresses
- Intelligent character replacement, including smart handling of:
- quote marks (โsingleโ, โdoubleโ)
- dashes (โโโ)
- ellipses (โฆ)
- trademarks, copyright & service marks (โข ยฉ)
- math symbols (5ร5ร5=53)
- fractions (1โ16)
- ordinal suffixes (1st, 2nd)
- CSS hooks for styling:
- ampersands,
- uppercase words,
- numbers,
- initial quotes & guillemets.
Requirements
- PHP 7.4.0 or above
- The
mbstringextension
Installation
The best way to use this package is through Composer:
$ composer require mundschenk-at/php-typography $ vendor/bin/update-iana.php
Basic Usage
- Create a
Settingsobject and enable the fixes you want. - Create a
PHP_Typographyinstance and use it to process HTML fragments (or whole documents) using your defined settings.
$settings = new \PHP_Typography\Settings(); $settings->set_hyphenation( true ); $settings->set_hyphenation_language( 'en-US' ); $typo = new \PHP_Typography\PHP_Typography(); $hyphenated_html = $typo->process( $html_snippet, $settings );
Roadmap
Please have a look at ROADMAP file for upcoming releases.
License
PHP-Typography is licensed under the GNU General Public License 2 or later - see the LICENSE file for details.
