Skip to content

PHP wrapper around the `chardet` command

License

Notifications You must be signed in to change notification settings

p1umbum/php-chardet

 
 

Repository files navigation

php-chardet Build Status Coverage Status Packagist Packagist

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

About

PHP wrapper around the `chardet` command

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.1%
  • Shell 1.9%