承接 bitandblack/word-wrapper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bitandblack/word-wrapper

最新稳定版本:2.3.0

Composer 安装命令:

composer require bitandblack/word-wrapper

包简介

Wrapping words for a perfect typography

README 文档

README

PHP from Packagist Latest Stable Version Total Downloads License

Bit&Black Word Wrapper

Wrapping text for a perfect typography.

Installation

This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/word-wrapper.

Usage

These wrappers are available:

  • LinesWrapper: This class divides a text to reach a given number of lines.
  • MaxLengthWrapper: This class wraps a text when a lines reaches the maximum length of characters.

These outputs are available:

  • CSSOutput: This class uses <span> to divide the lines. Each span has class="word-wrapper-line" which you can use to define a wrap by your own. For example white-space: nowrap is very useful here. It's possible to customize the tag.
  • HTMLOutput: This class uses <br> to wrap into new lines. It's possible to customize the tag.
  • CustomOutput: This class needs to know your custom string. This is the second parameter.

Example

This example makes use of the LinesWrapper and the HTMLOutput.

<?php 

use BitAndBlack\WordWrapper\Output\HTMLOutput;
use BitAndBlack\WordWrapper\Wrapper\LinesWrapper;

$sentence = 'The Lord of the Rings';
$wrapper = new LinesWrapper(2, $sentence);
echo new HTMLOutput($wrapper);

This will echo The Lord of <br>the Rings.

Help

If you have questions feel free to contact us under hello@bitandblack.com.

Further information about Bit&Black can be found under www.bitandblack.com.

统计信息

  • 总下载量: 1.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-26