chr15k/php-typos
Composer 安装命令:
composer require chr15k/php-typos
包简介
Native, ultra-fast spellchecking and fixing for PHP codebases.
关键字:
README 文档
README
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.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-23