php-typography

A PHP library for improving your web typography.

Github星跟蹤圖

PHP-Typography

Build Status
Latest Stable Version
Scrutinizer Code Quality
Code 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 (116)
    • ordinal suffixes (1st, 2nd)
  • CSS hooks for styling:
    • ampersands,
    • uppercase words,
    • numbers,
    • initial quotes & guillemets.

Requirements

  • PHP 5.6.0 or above
  • The mbstring extension

Installation

The best way to use this package is through Composer:

$ composer require mundschenk-at/php-typography
$ vendor/bin/update-iana.php

Basic Usage

  1. Create a Settings object and enable the fixes you want.
  2. Create a PHP_Typography instance 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.

主要指標

概覽
名稱與所有者mundschenk-at/php-typography
主編程語言PHP
編程語言PHP (語言數: 2)
平台
許可證GNU General Public License v2.0
所有者活动
創建於2017-08-05 09:55:24
推送於2024-06-15 19:02:43
最后一次提交
發布數32
最新版本名稱v6.7.0 (發布於 )
第一版名稱v5.0.0-beta.1 (發布於 )
用户参与
星數75
關注者數5
派生數6
提交數1.4k
已啟用問題?
問題數67
打開的問題數11
拉請求數109
打開的拉請求數1
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?