PHPackages                             mlocati/chm-lib - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mlocati/chm-lib

ActiveLibrary

mlocati/chm-lib
===============

Read CHM (Microsoft Compiled HTML Help) files

1.3.0(6y ago)25246↓100%7[2 issues](https://github.com/mlocati/chm-lib/issues)MITPHPPHP &gt;=5.3.3CI passing

Since May 5Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/mlocati/chm-lib)[ Packagist](https://packagist.org/packages/mlocati/chm-lib)[ Docs](https://github.com/mlocati/chm-lib)[ GitHub Sponsors](https://github.com/sponsors/mlocati)[ Fund](https://www.paypal.me/mlocati)[ RSS](/packages/mlocati-chm-lib/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

[![Tests](https://github.com/concrete5-community/alert_popup/actions/workflows/tests.yml/badge.svg)](https://github.com/concrete5-community/alert_popup/actions/workflows/tests.yml)[![Coverage Status](https://camo.githubusercontent.com/918daed332fa7ef84e417075ad6115e11d436003094d4212f165b3499714288c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6c6f636174692f63686d2d6c69622f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/mlocati/chm-lib?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0640fc080a5f287c5b2d01e8127eb36d38761e24229a3d1f1253737527c32073/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6c6f636174692f63686d2d6c69622f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mlocati/chm-lib/?branch=master)

CHMLib - Read CHM files from PHP
================================

[](#chmlib---read-chm-files-from-php)

This PHP library can read CHM (Microsoft Compiled HTML Help) files and extract their contents.

There's no external dependencies to use this library: the only requirement is PHP 5.3.3 or greater (PHP 7 and HHVM are supported too).

Tests
-----

[](#tests)

You can run your own tests against this library (see [here](https://github.com/mlocati/chm-lib/blob/master/test/samples/README.md) for details). In the GitHub repo I included only one test file, but I tested locally all the CHM files I found in my PC (they are about 400), and everything worked like a charm:wink:.

Sample usage
------------

[](#sample-usage)

### Analyzing the contents of a CHM file

[](#analyzing-the-contents-of-a-chm-file)

```
require_once 'CHMLib.php'; // You don't need this if you use Composer

$chm = \CHMLib\CHM::fromFile('YourFile.chm');
foreach ($chm->getEntries(\CHMLib\Entry::TYPE_FILE) as $entry) {
    echo "File: ", $entry->getPath(), "\n";
    echo "Contents: ", $entry->getContents(), "\n\n";
}
```

### Extracting the contents of a CHM file to a local directory

[](#extracting-the-contents-of-a-chm-file-to-a-local-directory)

```
