yupmin/php-chardet

php-chardet

1.0.1 2015-10-27 13:00 UTC

This package is auto-updated.

Last update: 2024-03-29 02:26:00 UTC


README

Introduction

PHP wrapper around the chardet command

Table of contents:

Installation

1 - Install chardet

You should install chardet:

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

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

Reference