A lightweight utility for string conversion between text from UTF8 to a lot of formats and vice-versa.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gen
src
tests
.gitignore
.travis.yml
LICENSE
README.md
composer.json
example.php
phpunit.xml.dist

README.md

Convert

Build Status SensioLabsInsight

Description

A lightweight utility for string conversion between text from UTF8 to a lot of formats and vice-versa.

Examples

<?php
$str = \ByJG\Convert\ToUTF8::fromHtmlEntities('Jo&atilde;o');
echo $str; // João

$str2 = \ByJG\Convert\FromUTF8::toHtmlEntities('João');
echo $str2; // Jo&atilde;o

$str3 = \ByJG\Convert\FromUTF8::removeAccent('João');
echo $str3; // Joao

$str4 = \ByJG\Convert\FromUTF8::toIso88591Email('João');
echo $str4; // =?iso-8859-1?Q?Jo=E3o?=

$str5 = \ByJG\Convert\FromUTF8::onlyAscii('Joãoᅠ');
echo $str5; // Joao

// https://en.wikipedia.org/wiki/Combining_character
$str6 = \ByJG\Convert\ToUTF8::fromCombiningChar($combining);
echo $str6; 

Install

Just type: composer install "byjg/convert=1.0.*"

Running Tests

phpunit