A blistering fast source code spellchecker for PHP projects, powered by the typos Rust CLI.
The correct platform binary ships with the package — no Rust, Cargo, or Homebrew required. Run it the same way you run Pint or PHPStan, and it works the same way in CI.
- PHP 8.3+
- Linux (x86_64 / ARM64), macOS (x86_64 / ARM64), or Windows (x86_64)
Install as a development dependency:
composer require chr15k/php-typos --devThen initialise a configuration file in your project root:
./vendor/bin/typos --initThis copies a _typos.toml file to your project root where you can configure paths to exclude and words to ignore.
Scan the entire project from the current directory:
./vendor/bin/typosScan specific paths:
./vendor/bin/typos app/
./vendor/bin/typos app/ tests/ config/Copies the default _typos.toml configuration file into your project root. Safe to run on a fresh project — it will not overwrite an existing config.
./vendor/bin/typos --initAutomatically fix discovered typos by writing corrections directly to the affected files.
./vendor/bin/typos --write
./vendor/bin/typos src/ --writeCannot be used together with
--diff.
Show a unified diff of proposed corrections without modifying any files. Useful for reviewing what --write would change before committing to it.
./vendor/bin/typos --diff
./vendor/bin/typos src/ --diffCannot be used together with
--write.
List the files being scanned without checking for typos.
./vendor/bin/typos --files
./vendor/bin/typos src/ --filesList all identifiers (variable names, function names, etc.) found during the scan.
./vendor/bin/typos --identifiersList all words found during the scan.
./vendor/bin/typos --wordsControl the output format. Defaults to long.
| Value | Description |
|---|---|
long |
Full output with file path, line, and correction detail (default) |
brief |
One line per file with typos |
json |
Machine-readable JSON, suitable for CI annotation tools |
./vendor/bin/typos --format=json
./vendor/bin/typos --format=briefPath to a custom _typos.toml configuration file. Defaults to the one in your project root.
./vendor/bin/typos --config=path/to/_typos.tomlThe _typos.toml file controls which paths are excluded and which words are globally ignored.
[files]
extend-exclude = [
"vendor",
"node_modules",
"bootstrap/cache",
"storage",
".git",
"public"
]
[default.extend-words]
# Words to skip globally (key and value must match)
# creeate = "creeate"- name: Check for typos
run: ./vendor/bin/typosFor annotation-friendly output:
- name: Check for typos
run: ./vendor/bin/typos --format=jsonAdd a script to your composer.json to run alongside your other checks:
"scripts": {
"typos:check": "typos",
"ci": [
"@lint:check",
"@refactor:check",
"@types:check",
"@typos:check",
"@unit"
],
}| OS | Architecture |
|---|---|
| macOS | x86_64, ARM64 (Apple Silicon) |
| Linux | x86_64, ARM64 |
| Windows | x86_64 |
MIT — see LICENSE for details.