belniakmedia/hunspell-php

Hunspell PHP wrapper

Installs: 51

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 3

pkg:composer/belniakmedia/hunspell-php

3.0.0 2025-10-30 23:31 UTC

This package is auto-updated.

Last update: 2025-10-30 23:32:35 UTC


README

Forked from johnzuk/HunspellPHP

Version 3.0.0 (Very minor backward breaking change)

This version updates the constructor signature with a different (better?) default value for $encoding, so if anyone was using that this would be a backward breaking change. Otherwise, a new constructor argument $custom_word_file (path) has been added and will bind your provided custom word list with your dictionary in real time.

The other change this version takes care of is using proc_open and better env/encoding handling in general. We also now emmit an error_log() call so stderr output from the hunspell process are logged properly.

Version 2.0.0

Version 2.0.0 and above requires PHP ^8.0.0 and includes an important fix to the result matcher regex. If you need this for an older version of PHP I recommend that you fork 1.2 and update the regex matcher property of the Hunspell class to what is set in the current version of the code.

View Changelog

The reason for this fork

This project was initially forked because the shell commands used were for a non-bash shell. This fork's main purpose was to convert the shell commands to a BASH compatible syntax and add support for Windows powershell. As such this fork will not work correctly outside of a bash or powershell environment.

An additional change was made to the parsing of the return value as the PHP_EOL value used in the original source was not working in my testing. This was changed to "\n" which resolved the issue.

Example

$hunspell = new \HunspellPHP\Hunspell();
var_dump($hunspell->find('otwórz'));