mundschenk-at/php-typography
最新稳定版本:v6.7.0
Composer 安装命令:
composer require mundschenk-at/php-typography
包简介
A PHP library for improving your web typography
README 文档
README
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.
统计信息
- 总下载量: 918.25k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 76
- 点击次数: 1
- 依赖项目数: 13
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2017-08-06