descom / file_encoding
PHP class to encode files
1.0.1
2018-01-30 15:04 UTC
Requires
- php: ^5.6 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-12-07 12:59:14 UTC
README
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';