Skip to content

descom-es/php-file-encoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StyleCI Build Status

PHP convert files encoding

PHP class to convert files encoding

Installation

You can install it with composer:

composer require descom/file_encoding

Usage

encodeFile($file, $encoding_to, $encodings_detected);

This is an example:

use Descom\File\Encoding;

$codification = new Encoding();

$file = 'file.txt';
$encoding_to = 'UTF-8';
$encodings_detected = 'UTF-8,ISO-8859-1,WINDOWS-1252';

$result = $codification->encodeFile($file, $encoding_to, $encodings_detected);

Encoding values

Allowed encodings

http://php.net/manual/es/mbstring.supported-encodings.php

Default values

$encoding_to = 'UTF-8';
$encodings_detected = 'UTF-8,ISO-8859-1,WINDOWS-1252';