PHP spell check library

Overview

php-speller

PHP spell check library.

Latest Stable Version License Build Status Coverage Status

Currently supported backends:

Installation

With Composer:

$ composer require mekras/php-speller

Usage

  1. Create a text source object from string, file or something else using one of the Mekras\Speller\Source\Source implementations (see Sources below).
  2. Create some speller instance (Hunspell, Ispell or any other implementation of the Mekras\Speller\Speller).
  3. Execute Speller::checkText() method.
use Mekras\Speller\Hunspell\Hunspell;
use Mekras\Speller\Source\StringSource;

$source = new StringSource('Tiger, tigr, burning bright');
$speller = new Hunspell();
$issues = $speller->checkText($source, ['en_GB', 'en']);

echo $issues[0]->word; // -> "tigr"
echo $issues[0]->line; // -> 1
echo $issues[0]->offset; // -> 7
echo implode(',', $issues[0]->suggestions); // -> tiger, trig, tier, tigris, tigress

You can list languages supported by backend:

/** @var Mekras\Speller\Speller $speller */
print_r($speller->getSupportedLanguages());

See examples for more info.

Source encoding

For aspell, hunspell and ispell source text encoding should be equal to dictionary encoding. You can use IconvSource to convert source.

Aspell

This backend uses aspell program, so it should be installed in the system.

use Mekras\Speller\Aspell\Aspell;

$speller = new Aspell();

Path to binary can be set in constructor:

use Mekras\Speller\Aspell\Aspell;

$speller = new Aspell('/usr/local/bin/aspell');

Custom Dictionary

You can use a custom dictionary for aspell. The dictionary needs to be in the following format:

personal_ws-1.1 [lang] [words]

Where [lang] shout be the shorthand for the language you are using (e.g. en) and [words] is the count of words inside the dictionary. Beware that there should no spaces at the end of words. Each word should be listed in a new line.

$aspell = new Aspell();
$aspell->setPersonalDictionary(new Dictionary('/path/to/custom.pws'));

Important

  • aspell allow to specify only one language at once, so only first item taken from $languages argument in Ispell::checkText().

Hunspell

This backend uses hunspell program, so it should be installed in the system.

use Mekras\Speller\Hunspell\Hunspell;

$speller = new Hunspell();

Path to binary can be set in constructor:

use Mekras\Speller\Hunspell\Hunspell;

$speller = new Hunspell('/usr/local/bin/hunspell');

You can set additional dictionary path:

use Mekras\Speller\Hunspell\Hunspell;

$speller = new Hunspell();
$speller->setDictionaryPath('/var/spelling/custom');

You can specify custom dictionaries to use:

use Mekras\Speller\Hunspell\Hunspell;

$speller = new Hunspell();
$speller->setDictionaryPath('/my_app/spelling');
$speller->setCustomDictionaries(['tech', 'titles']);

Ispell

This backend uses ispell program, so it should be installed in the system.

use Mekras\Speller\Ispell\Ispell;

$speller = new Ispell();

Path to binary can be set in constructor:

use Mekras\Speller\Ispell\Ispell;

$speller = new Ispell('/usr/local/bin/ispell');

Important

  • ispell allow to use only one dictionary at once, so only first item taken from $languages argument in Ispell::checkText().

Sources

Sources — is an abstraction layer allowing spellers receive text from different sources like strings or files.

FileSource

Reads text from file.

use Mekras\Speller\Source\FileSource;

$source = new FileSource('/path/to/file.txt');

You can specify file encoding:

use Mekras\Speller\Source\FileSource;

$source = new FileSource('/path/to/file.txt', 'windows-1251');

StringSource

Use string as text source.

use Mekras\Speller\Source\StringSource;

$source = new StringSource('foo', 'koi8-r');

Meta sources

Additionally there is a set of meta sources, which wraps other sources to perform extra tasks.

HtmlSource

Return user visible text from HTML.

use Mekras\Speller\Source\HtmlSource;

$source = new HtmlSource(
    new StringSource('<a href="#" title="Foo">Bar</a> Baz')
);
echo $source->getAsString(); // Foo Bar Baz

Encoding detected via DOMDocument::$encoding.

IconvSource

This is a meta-source which converts encoding of other given source:

use Mekras\Speller\Source\IconvSource;
use Mekras\Speller\Source\StringSource;

// Convert file contents from windows-1251 to koi8-r.
$source = new IconvSource(
    new FileSource('/path/to/file.txt', 'windows-1251'),
    'koi8-r'
);

XliffSource

Loads text from XLIFF files.

use Mekras\Speller\Source\XliffSource;

$source = new XliffSource(__DIR__ . '/fixtures/test.xliff');

Source filters

Filters used internally to filter out all non text contents received from source. In order to save original word location (line and column numbers) all filters replaces non text content with spaces.

Available filters:

Comments
  • Failed to execute

    Failed to execute "hunspell -i UTF-8 -a": Can't open affix or dictionary files for dictionary named "default".

    Hello!

    Sorry to bother you but since v1.6 I get this error. I'm running on CentOs with International Ispell Version 3.2.06 (but really Hunspell 1.3.2) After dowgrading to v1.5.1 it works just fine.

    Here is my code for execution: $this->speller = new Hunspell(); $this->speller->setDictionaryPath('.../hunspell/custom'); $this->speller->setCustomDictionaries('fr']);

    Maybe it's a problem with Hunspell v1.3.2 but unfortunately I'm not able to upgrade it.

    thx in advance

    bug 
    opened by ScherlOMatic 5
  • Actually update to use symfony/process ^5.0

    Actually update to use symfony/process ^5.0

    Call to undefined method Symfony\Component\Process\Process::inheritEnvironmentVariables()
    (vendor/mekras/php-speller/src/ExternalSpeller.php)
    
    Call to undefined method Symfony\Component\Process\Process::setCommandLine()
    (vendor/mekras/php-speller/src/ExternalSpeller.php)
    

    image

    -- https://github.com/symfony/process/blob/master/CHANGELOG.md

    Can you update, so it doesn't only allow v5 but also works with it? :-)

    Thanks!

    opened by repat 4
  • composer(deps): update symfony/process requirement from ^4.4 || ^5.0 || ^6.0 to ^5.4.7

    composer(deps): update symfony/process requirement from ^4.4 || ^5.0 || ^6.0 to ^5.4.7

    Updates the requirements on symfony/process to permit the latest version.

    Release notes

    Sourced from symfony/process's releases.

    v5.4.7

    Changelog (https://github.com/symfony/process/compare/v5.4.6...v5.4.7)

    • bug #45676 Don't return executable directories in PhpExecutableFinder (fancyweb)
    Changelog

    Sourced from symfony/process's changelog.

    CHANGELOG

    5.2.0

    • added Process::setOptions() to set Process specific options
    • added option create_new_console to allow a subprocess to continue to run after the main script exited, both on Linux and on Windows

    5.1.0

    • added Process::getStartTime() to retrieve the start time of the process as float

    5.0.0

    • removed Process::inheritEnvironmentVariables()
    • removed PhpProcess::setPhpBinary()
    • Process must be instantiated with a command array, use Process::fromShellCommandline() when the command should be parsed by the shell
    • removed Process::setCommandLine()

    4.4.0

    • deprecated Process::inheritEnvironmentVariables(): env variables are always inherited.
    • added Process::getLastOutputTime() method

    4.2.0

    • added the Process::fromShellCommandline() to run commands in a shell wrapper
    • deprecated passing a command as string when creating a Process instance
    • deprecated the Process::setCommandline() and the PhpProcess::setPhpBinary() methods
    • added the Process::waitUntil() method to wait for the process only for a specific output, then continue the normal execution of your application

    4.1.0

    • added the Process::isTtySupported() method that allows to check for TTY support
    • made PhpExecutableFinder look for the PHP_BINARY env var when searching the php binary
    • added the ProcessSignaledException class to properly catch signaled process errors

    4.0.0

    • environment variables will always be inherited
    • added a second array $env = [] argument to the start(), run(),

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 3
  • Support Symfony 6

    Support Symfony 6

    Hi folkes! Love the lib, use it on one of my projects extensively!

    I am in the middle of trying to upgrade my codebases to run on Laravel 9 and because they now based out of Symfony 6, This package is blocking the upgrade, So suggesting support to include the latest version!

    All my best 🥇

    opened by genericmilk 3
  • PHP8 Support

    PHP8 Support

    Hi @mekras Hi @icanhazstring

    would it be possible for you to quickly add PHP8 Support? The package seems to work under PHP8, we'd just need to change "php": "^7.1" to "php": ">=7.1" in the composer.json and release a new version.

    Thanks!

    opened by repat 3
  • composer(deps): update symfony/process requirement from ^4.4 || ^5.0 to ^5.4.5

    composer(deps): update symfony/process requirement from ^4.4 || ^5.0 to ^5.4.5

    Updates the requirements on symfony/process to permit the latest version.

    Release notes

    Sourced from symfony/process's releases.

    v5.4.5

    Changelog (https://github.com/symfony/process/compare/v5.4.4...v5.4.5)

    • no significant changes
    Changelog

    Sourced from symfony/process's changelog.

    CHANGELOG

    5.2.0

    • added Process::setOptions() to set Process specific options
    • added option create_new_console to allow a subprocess to continue to run after the main script exited, both on Linux and on Windows

    5.1.0

    • added Process::getStartTime() to retrieve the start time of the process as float

    5.0.0

    • removed Process::inheritEnvironmentVariables()
    • removed PhpProcess::setPhpBinary()
    • Process must be instantiated with a command array, use Process::fromShellCommandline() when the command should be parsed by the shell
    • removed Process::setCommandLine()

    4.4.0

    • deprecated Process::inheritEnvironmentVariables(): env variables are always inherited.
    • added Process::getLastOutputTime() method

    4.2.0

    • added the Process::fromShellCommandline() to run commands in a shell wrapper
    • deprecated passing a command as string when creating a Process instance
    • deprecated the Process::setCommandline() and the PhpProcess::setPhpBinary() methods
    • added the Process::waitUntil() method to wait for the process only for a specific output, then continue the normal execution of your application

    4.1.0

    • added the Process::isTtySupported() method that allows to check for TTY support
    • made PhpExecutableFinder look for the PHP_BINARY env var when searching the php binary
    • added the ProcessSignaledException class to properly catch signaled process errors

    4.0.0

    • environment variables will always be inherited
    • added a second array $env = [] argument to the start(), run(),

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 2
  • HtmlFilter raises Error with malformed HTML tags

    HtmlFilter raises Error with malformed HTML tags

    Hi,

    I encounter the following error TypeError: strcasecmp() expects parameter 2 to be string, null given while I check HTML text with malformed tags like foo/>bar<br><br/>.

    This issue comes from here. The error is raised when the name of the tag is null.

    opened by olivierpontier 2
  • Aspell output parsing for Swedish

    Aspell output parsing for Swedish

    Hello,

    I encounter an error while parsing the output of Aspell for Swedish sentences with words containing a colon (:) - in Swedish and Finnish, words can contain colons, see https://en.wikipedia.org/w/index.php?title=Colon_(punctuation)

    here is the output of aspell:

    $ aspell --lang=sv --encoding=UTF-8 -a
    @(#) International Ispell Version 3.1.20 (but really Aspell 0.60.7-20110707)
    S:t Petersburg är i Ryssland
    & S:t 23 0: St, Set, Sot, Söt, Stl, Stå, Sy, Ät, Åt, Est, Ost, Öst, SI, SM, TT, Sa, Se, Sk, So, Så, Ut, Yt, SJ
    ? Petersburg 0 4: Peters
    *
    *
    *
    

    The issue comes from here: as there is more than one colon in the line, the $parts contains more than 2 elements, and at line 192, $parts[0][3] is not set, resulting in a notice, and even a fatal error if strict_types is enabled (PHP Fatal error: Uncaught TypeError: trim() expects parameter 1 to be string, null given).

    I guess a regexp would be more suitable in this case, I can try to do a PR if needed (though I'm not sure how to implement the tests yet...)

    opened by mmetayer 2
  • Fix PHP error triggered by malformed HTML attributes

    Fix PHP error triggered by malformed HTML attributes

    This PR fixes a PHP error that can occur when there is a malformed attribute in the HTML source (for example <p ""="">test</p>).

    The error is the following :

    Uncaught PHP Exception TypeError: "strtolower() expects parameter 1 to be string, null given" at vendor/mekras/php-speller/src/Source/Filter/HtmlFilter.php line 156
    

    I was able to reproduce the error in the unit tests and fix it.

    Thanks for this very useful library :)

    opened by rouliane 2
  • Maintaining the repo

    Maintaining the repo

    Hi @mekras. First off - love this lib for spell checking. Unfortunately you seem to have other priorities.

    I would love to take this repo under my care - or at least be able to collaborate as a maintainer.

    Greets

    opened by icanhazstring 2
  • github-actions(deps): bump shivammathur/setup-php from 2.21.1 to 2.22.0

    github-actions(deps): bump shivammathur/setup-php from 2.21.1 to 2.22.0

    Bumps shivammathur/setup-php from 2.21.1 to 2.22.0.

    Release notes

    Sourced from shivammathur/setup-php's releases.

    2.22.0

    Support Ukraine


    - name: Setup PHP with debugging symbols
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        debug: true 
    
    - name: Setup PHP with intl
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
        extensions: intl-72.1
    
    • Existing PHP version on GitHub actions Ubuntu images is now updated if ppa:ondrej/php is missing regardless of the updateactions/runner-images#6331

    • Environment variable COMPOSER_NO_AUDIT is now set by default. If you would like to run the composer audit in your workflows, please add a step with composer audit command. (#635, #636)

    - name: Composer audit
      run: composer audit
    
    • Switched to GITHUB_OUTPUT environment file for setting up outputs. If you are using setup-php on self-hosted runners, please update it to 2.297.0 or greater. More Info (#654)

    • Updated sqlsrv and pdo_sqlsrv version to 5.10.1 for PHP 7.0 and above on Linux.

    • Improved support for phalcon5 extension to set up the latest stable version.

    • Improved symfony-cli support to fetch the artifact URL from the brew tap on Linux. (#641, #652, #653)

    • Improved fetching brew taps on Linux to avoid brew's overhead.

    • Fixed installing extension packages on self-hosted Linux runners. (#642)

    • Fixed support for couchbase and firebird extensions after GitHub release page changes.

    ... (truncated)

    Commits
    • 1a18b22 Add note about updating PHP if ppa is missing on Ubuntu
    • e970483 Update Node.js dependencies
    • 5178fac Update PHP if ppa:ondrej/php is missing ref: actions/runner-images#6331
    • 388883d Fix support for firebird and couchbase
    • cae6d06 Improve phalcon support
    • 89f4f7e Run configure_pecl only when ini_files are set
    • d2efbcd Fix debug support on Linux
    • 98e3af0 Configure brew on linux on grpc_php_plugin setup
    • e8836c6 Fix logs on failure in add_pecl_extension
    • 9068f2e Update sqlsrv and pdo_sqlsrv to 5.10.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependency 
    opened by dependabot[bot] 1
  • github-actions(deps): bump shivammathur/setup-php from 2.21.1 to 2.23.0

    github-actions(deps): bump shivammathur/setup-php from 2.21.1 to 2.23.0

    Bumps shivammathur/setup-php from 2.21.1 to 2.23.0.

    Release notes

    Sourced from shivammathur/setup-php's releases.

    2.23.0

    Support Ukraine


    • Added support for nightly builds of PHP 8.3. Note: Specifying nightly as the php-version now will set up PHP 8.3.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.3'
    
    • PHP 8.2 is now stable on setup-php. #673 Notes:
      • Specifying latest or 8.x as the php-version now will set up PHP 8.2.
      • Except ubuntu-22.04, all GitHub runners now have PHP 8.2 as the default version.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2'
    
    • Added support for thread-safe builds of PHP on Linux. #651
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2'
      env:
        phpts: ts
    

    ... (truncated)

    Commits
    • 8e2ac35 Update README
    • a1e6789 Improve Get-PhalconReleaseAssetUrl
    • 9114b00 Restore stability workaround for PHP 8.1 on Windows
    • cb0c293 Fix typo in blackfire regex on Windows
    • 387ec95 Improve fetching phalcon release url on Windows
    • 3514d30 Allow major.minor protoc versions
    • e186e47 Bump version to 2.23.0
    • e51e662 Add support to install extensions from shivammathur/php-extensions-windows
    • 5afd8a1 Fix error in darwin.sh while updating dependencies
    • 1a42045 Use ls-remote to get default branch
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependency 
    opened by dependabot[bot] 0
  • Calling Aspell::getSupportedLanguages() breaks checkText()

    Calling Aspell::getSupportedLanguages() breaks checkText()

    When calling getSupportedLanguages() before checkText(), even the arguments are ok, the process command is not updated.

    ###########################
    /vendor/mekras/php-speller/src/ExternalSpeller.php (line 218)
    ########## DEBUG ##########
    [
    	(int) 0 => '/usr/bin/aspell',
    	(int) 1 => '--encoding=UTF-8',
    	(int) 2 => '-a',
    	(int) 3 => '--lang=en'
    ]
    ###########################
    /vendor/mekras/php-speller/src/ExternalSpeller.php (line 224)
    ########## DEBUG ##########
    object(Symfony\Component\Process\Process) {
    	[private] callback => null
    	[private] hasCallback => false
    	[private] commandline => [
    		(int) 0 => '/usr/bin/aspell',
    		(int) 1 => 'dump',
    		(int) 2 => 'dicts'
    	]
    	[private] cwd => '/var/www/.../trunk/src'
    	[private] env => null
    	[private] input => null
    	[private] starttime => (float) 1601305301.2421
    	[private] lastOutputTime => (float) 1601305301.2454
    	[private] timeout => (float) 600
    	[private] idleTimeout => null
    	[private] exitcode => (int) 0
    	[private] fallbackStatus => []
    	[private] processInformation => [
    		'command' => 'exec '/usr/bin/aspell' 'dump' 'dicts'',
    		'pid' => (int) 868,
    		'running' => false,
    		'signaled' => false,
    		'stopped' => false,
    		'exitcode' => (int) 0,
    		'termsig' => (int) 0,
    		'stopsig' => (int) 0
    	]
    	[private] outputDisabled => false
    	[private] stdout => resource
    	[private] stderr => resource
    	[private] process => unknown
    	[private] status => 'terminated'
    	[private] incrementalOutputOffset => (int) 0
    	[private] incrementalErrorOutputOffset => (int) 0
    	[private] tty => false
    	[private] pty => false
    	[private] useFileHandles => false
    	[private] processPipes => object(Symfony\Component\Process\Pipes\UnixPipes) {
    		pipes => []
    		[private] ttyMode => false
    		[private] ptyMode => false
    		[private] haveReadSupport => true
    	}
    	[private] latestSignal => null
    	[private] sigchild => false
    }
    

    Adding $this->resetProcess(); to getSupportedLanguages() fixes it.

    opened by nachitox 0
  • Mekras\Speller\Exception\ExternalProgramFailedException Failed to execute

    Mekras\Speller\Exception\ExternalProgramFailedException Failed to execute "hunspell -D": 'hunspell' is not recognized as an internal or external command, operable program or batch file.

    Hi ,

    I would like to ask for help regarding of this issue . I have already made a LANG Environment on Apache but still have this issue. Can anyone help with this ? . Thank you

    image

    image

    image

    opened by tancincozach 1
  • no word lists can be found for the language en_us

    no word lists can be found for the language en_us

    Hello,

    I have installed the php-speller but its nor working. I am getting the error: no word lists can be found for the language en_us.

    After searching google I found something that I need to install Aspell-en. Please let me know how can I install the Aspell-en or can solve the issue.

    Thanks

    question 
    opened by virenderkmr92 2
  • Failed to execute

    Failed to execute "hunspell -D": 'hunspell' is not recognized as an internal or external command, operable program or batch file.

    When I execute the following code in Laravel 5.8 ,the error is shown as in Hunspell.php

    ` $source = new StringSource('Tiger, tigr, burning bright'); $speller = new Hunspell(); $issues = $speller->checkText($source, ['en_GB', 'en']);

    echo $issues[0]->word; // -> "tigr" echo $issues[0]->line; // -> 1 echo $issues[0]->offset; // -> 7 echo implode(',', $issues[0]->suggestions); `

    Failed to execute "hunspell -D": 'hunspell' is not recognized as an internal or external command, operable program or batch file.

    I checked over the internet but all went vain. Yes I have put name space. I try debugging, and i came to know that process isSuccessful is returning false. Please suggest me something, how can i solve this issue?

    opened by try-no-cry 1
Releases(2.2.0)
  • 2.2.0(Mar 31, 2022)

    What's Changed

    • composer(deps-dev): update squizlabs/php_codesniffer requirement from ^3.5 to ^3.6 by @dependabot in https://github.com/mekras/php-speller/pull/34
    • Support Symfony 6 by @genericmilk in https://github.com/mekras/php-speller/pull/33
    • Drop support for PHP 7.1 and 7.2

    New Contributors

    • @dependabot made their first contribution in https://github.com/mekras/php-speller/pull/34
    • @genericmilk made their first contribution in https://github.com/mekras/php-speller/pull/33

    Full Changelog: https://github.com/mekras/php-speller/compare/2.1.4...2.2.0

    Source code(tar.gz)
    Source code(zip)
  • 2.1.4(Mar 15, 2021)

  • 2.1.3(Sep 23, 2020)

  • 2.1.2(Aug 20, 2020)

  • 2.1.1(Jun 18, 2020)

  • 2.1.0(May 17, 2020)

    Fixed

    • Fixed issue with removed and deprecated methods for symfony/process:^4.0

    Changed

    • Add requirement for php:^7.2
    • Changed minimum requirement for symfony/process to ^4.4
    Source code(tar.gz)
    Source code(zip)
  • 2.0.4(Apr 30, 2020)

  • 2.0.3(Apr 28, 2020)

  • 2.0.2(Jan 25, 2019)

  • 2.0.1(Jan 18, 2019)

  • v2.0(Jan 17, 2019)

  • v1.7.2(Apr 29, 2017)

    Fixed

    • HtmlFilter: