wernerdweight/canonicalizer
最新稳定版本:2.0.1
Composer 安装命令:
composer require wernerdweight/canonicalizer
包简介
Simple PHP string canonicalizer
关键字:
README 文档
README
Simple PHP string canonicalizer
Instalation
- Download using composer
composer require wernerdweight/canonicalizer
- Use in your project
use WernerDweight\Canonicalizer\Canonicalizer; $string = 'This is an interesteing string with some strange cháračtěřš in it. Хорошо?' $maxLength = 255; // maximal resulting canonical length (excessive chars will be trimmed) $canonicalizer = new Canonicalizer($maxLength); $canonical = $canonicalizer->canonicalize($string); echo $canonical; // this-is-an-interesting-string-with-some-strange-characters-in-it-choroso
API
-
canonicalize(string $string[, string $ending[, string $separator]]): string\$string- string to be canonicalized,$ending- string to be appended at the end of canonicalized string (ending is included in$maxLength) - useful to append ids, file formats etc.; default''(empty string),$separator- string used to separate canonicalized words; default-(dash).
-
setBeforeCallback(?callable): self
Allows to set a callback function that will be called before the given string is canonicalized.
The callback should respenct this definitionfunction (string): string.
Warning: the callback remains in place until explicitly nulled ($canonicalizer->setBeforeCallback(null)). -
setAfterCallback(?callebld): selfAllows to set a callback function that will be called after the given string is canonicalized. The callback should respenct this definitionfunction (string): string. Warning: the callback remains in place until explicitly nulled ($canonicalizer->setAfterCallback(null)).
统计信息
- 总下载量: 5.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-27