descom/file_encoding

PHP class to encode files

1.0.1 2018-01-30 15:04 UTC

This package is auto-updated.

Last update: 2024-12-07 12:59:14 UTC


README

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';