asleepwalker/typographie
Composer 安装命令:
composer require asleepwalker/typographie
包简介
Preparation of russian texts before web publication.
README 文档
README
Library for preparation of russian texts to web publication.
Core of Typographie web service.
Installation
Add package to the composer.json:
composer require asleepwalker/typographie
Run Composer:
composer install
Example
<?php
use asleepwalker\typographie\Typographie;
$engine = new Typographie('quotes,inquot,dashes,specials,paragraphs');
$raw = 'Сервис "Typographie" - подготовка текстов к веб-публикации онлайн (с) 2014-2017';
echo $engine->process($raw);
// > Сервис «Typographie» — подготовка текстов к веб-публикации онлайн © 2014–2017
Actions
quotes : Correction of quotes: "" becomes «».
inquot (requires quotes) : Nested quotes: «„“» (otherwise — duplicate quotes stashing).
dashes : If necessary replace hyphens with dashes and minus signs.
angles : Replace asterisks and quotes with degrees, feet, inches.
dblspace : Fix duplicate spaces in the text.
specials : Insert special characters (from the symbol table).
mathchars : Insert mathematical symbols (from the same table).
punctuation : Fix punctuation, such as spaces before commas.
specialspaces : Fix the wrong skip special characters with spaces.
nbsp : Attach short words to following words in the text.
hellip : Replace repeating dot symbols with ellipsis.
paragraphs : Puts paragraphs (<p>) when converting to HTML (with empty string as a delimeter).
safehtml : Don't process text inside of <code> and <pre> blocks.
entities : Replace special chars with HTML entities.
The list should be comma separated, e.g. action1,action2,action3.
Beside defining in the object constructor, use can change configuration by method actions:
$engine->actions('punctuation,dblspace');
echo $engine->process('К чёрту орфографию ,главное все понимают !Ведь так ?..');
// > К чёрту орфографию, главное все понимают! Ведь так?..
Modes
plain : Just plain text.
html : Safe HTML processing.
The mode could be defined in the constructor:
$engine = new Typographie('quotes,dashes', $in, $out);
Or by method mode:
$engine->mode('html', 'plain');
Default congifuration is plain mode for both input and output.
License
The MIT License.
asleepwalker/typographie 适用场景与选型建议
asleepwalker/typographie 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 101 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「text」 「web」 「russian」 「typography」 「articles」 「publication」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 asleepwalker/typographie 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 asleepwalker/typographie 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 asleepwalker/typographie 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Model of a web-based resource
Rutils Symfony 2 bundle
Analyze user input string, and split it into Russian first name, second name and last name
Retrieve a WebResourceInterface instance over HTTP
PHP версия типографа Муравьева
统计信息
- 总下载量: 101
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-12