定制 manialib/formatting 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

manialib/formatting

最新稳定版本:4.2.1

Composer 安装命令:

composer require manialib/formatting

包简介

Manipulate styles in Maniaplanet strings.

README 文档

README

Manialib\Formatting is a PHP package for manipulating styles in Maniaplanet strings.

Learn more about Maniaplanet formatting characters on the wiki.

Beta

Build Status Packagist Version Total Downloads SensioLabs Insight

This is a work in progress. As long as we don't release a stable version, we might break stuff at any point. If this is a problem, feel free to open an issue and we'll try to help.

Features

  • Strip styles from strings: links, colors, etc.
  • Convert strings to other formats: HTML for now

Find out more in the change log.

Requirements

  • PHP 8.1+

Installation

Install via Composer:

{
	"require": {
        "manialib/formatting": "^4.0"
    }
}

Usage

Modify styles of a string:

Note the String fluent interface which allows to chain method calls

use Manialib\Formatting\ManiaplanetString;

$nickname = '$l[https://github.com/manialib/formatting]$cfeg$fff๐u1 $666ツ$l';

$string = new ManiaplanetString($nickname);
echo $string->stripColors()->stripLinks();

Will output:

g๐u1 ツ

Convert a string to HTML:

use Manialib\Formatting\ManiaplanetString;

$string = new ManiaplanetString('$cfeg$fff๐u1 $666ツ');

echo $string->toHtml();

Will output:

<span style="color:#cfe;">g</span><span style="color:#fff;">๐u1 </span><span style="color:#666;"></span>

Everything you need for using this should be documented in Manialib/Formatting/StringInterface.

Tests

$ php vendor/bin/phpunit

$ php vendor/bin/phpcs --standard=PSR2 src

Development guidelines

We follow best practices from the amazing PHP ecosystem. Warm kudos to Symfony, The PHP League, the PHP subreddit and many more for inspiration and challenging ideas.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-12