chr15k/php-typos

Native, ultra-fast spellchecking and fixing for PHP codebases.

Maintainers

Package info

github.com/chr15k/php-typos

pkg:composer/chr15k/php-typos

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.2.0 2026-06-23 23:49 UTC

This package is auto-updated.

Last update: 2026-06-23 23:50:51 UTC


README

Logo for php typos

GitHub Workflow Status (master) Total Downloads Latest Version License

Typos for PHP

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.

Requirements

  • PHP 8.3+
  • Linux (x86_64 / ARM64), macOS (x86_64 / ARM64), or Windows (x86_64)

Installation

Install as a development dependency:

composer require chr15k/php-typos --dev

Then initialise a configuration file in your project root:

./vendor/bin/typos --init

This copies a _typos.toml file to your project root where you can configure paths to exclude and words to ignore.

Usage

Basic check

Scan the entire project from the current directory:

./vendor/bin/typos

Scan specific paths:

./vendor/bin/typos app/
./vendor/bin/typos app/ tests/ config/

Flags

--init / -i

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 --init

--write / -w

Automatically fix discovered typos by writing corrections directly to the affected files.

./vendor/bin/typos --write
./vendor/bin/typos src/ --write

Cannot be used together with --diff.

--diff / -d

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/ --diff

Cannot be used together with --write.

--format / -f

Control 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=brief

--config / -c

Path to a custom _typos.toml configuration file. Defaults to the one in your project root.

./vendor/bin/typos --config=path/to/_typos.toml

Configuration

The _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"

CI/CD Integration

GitHub Actions

- name: Check for typos
  run: ./vendor/bin/typos

For annotation-friendly output:

- name: Check for typos
  run: ./vendor/bin/typos --format=json

Composer script

Add a script to your composer.json to run alongside your other checks:

"scripts": {
    "ci": [
        "@lint:check",
        "@types:check",
        "@unit",
        "./vendor/bin/typos"
    ]
}

Supported Platforms

OS Architecture
macOS x86_64, ARM64 (Apple Silicon)
Linux x86_64, ARM64
Windows x86_64

License

MIT — see LICENSE for details.