php-chardet
Introduction
PHP wrapper around the chardet command, (*1)
Table of contents:
Installation
1 - Install chardet
You should install chardet:, (*2)
Using pip:
sudo pip install chardet
sudo ln -s /usr/local/bin/chardetect /usr/local/bin/chardet
On ubuntu linux:
sudo apt-get install python-chardet
2 - Integration in your php project
To use this library install it through Composer, run, (*3)
composer require yupmin/php-chardet
How to use
Retrieve chardet container
<?php
//...
use Yupmin\PHPChardet\Chardet;
//...
$chardet = new Chardet();
$chardetContainer = $chardet->analyze('test.txt');
$filePath = $chardetContainer->getFilePath();
$charset = $chardetContainer->getCharset();
$confidence = $chardetContainer->getConfidence();
//...
License
See LICENSE for more information, (*4)
Reference