Manialib\Formatting: manipulate styles with PHP
Posted: 03 Feb 2015, 13:12
Much hello,
We are soon releasing a little PHP package for manipulating styles in Maniaplanet strings. It's inspired from "StyleParser" in former manialib version, and also from TMFColorParser from back in the days
With our new approach to PHP and open source, we're now releasing it as a simple standalone PHP package, following modern PHP conventions.
Here's a little example:
Will output:
Convert a string to HTML:
Will output:
You can find out more at https://github.com/manialib/formatting
Right now it is tagged as "4.0.0-beta2", so not stable. If you need to use this in a project, we might draft a stable 4.0.0 release.
Your feedback is welcome
We are soon releasing a little PHP package for manipulating styles in Maniaplanet strings. It's inspired from "StyleParser" in former manialib version, and also from TMFColorParser from back in the days

With our new approach to PHP and open source, we're now releasing it as a simple standalone PHP package, following modern PHP conventions.
Here's a little example:
Code: Select all
use Manialib\Formatting\String;
$nickname = '$l[https://github.com/manialib/formatting]$cfeg$fffà¹u1 $666ツ$l';
$string = new String($nickname);
echo $string->stripColors()->stripLinks();
Code: Select all
gà¹u1 ツ
Code: Select all
use Manialib\Formatting\String;
$string = new String('$cfeg$fffà¹u1 $666ツ');
echo $string->toHtml();
Code: Select all
<span style="color:#cfe;">g</span><span style="color:#fff;">à¹u1 </span><span style="color:#666;">ツ</span>
Right now it is tagged as "4.0.0-beta2", so not stable. If you need to use this in a project, we might draft a stable 4.0.0 release.
Your feedback is welcome
