codeinc/strip-accents

Removes accents from strings

1.1.0 2020-07-17 15:54 UTC

This package is auto-updated.

Last update: 2024-12-18 02:37:44 UTC


README

This PHP 7 library removes accent from strings. It is based on the sample code published here.

Usage

<?php
use CodeInc\StripAccents\StripAccents;

echo StripAccents::strip("C'est une super chaîne de caractères avec beaucoup d'accents");
// echoes: C'est une super chaine de caracteres avec beaucoup d'accents

echo StripAccents::strip("ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ");
// echoes: AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy

echo StripAccents::stripNonPrint("ABC ÀÈÝ 是我这");
// echoes: ABC AEY ---

// You can specify any encoding supported by htmlentities() as a second parameter
echo StripAccents::strip("A strïng with àccénts", "iso-8859-1");

Installation

This library is available through Packagist and can be installed using Composer:

composer require codeinc/strip-accents

License

This library is published under the MIT license (see the LICENSE file).