vscode-phpcs
January 10, 2026 · View on GitHub
| Platform | Version | Installs | Rating |
|---|---|---|---|
| VS Marketplace | |||
| Open VSX |
Integrates phpcs (PHP_CodeSniffer) for linting and phpcbf (PHP Code Beautifier and Fixer) for auto-fixing code style issues into VS Code and compatible editors.
Extension History
This extension is the actively maintained continuation of the original PHPCS extensions:
ikappas.phpcs(versions 1.0.1 – 1.0.4) — The original extension by Ioannis Kappasshevaua.phpcs(versions 1.0.6 – 1.0.8) — Maintained by Igor Sheviakov
Both previous extensions are no longer maintained. This fork continues development with new features, bug fixes, and support for PHP_CodeSniffer v4.
Note for Open VSX users: This extension was previously published on the Open VSX Registry as
johnrdorazio.phpcs(versions 1.1.0 – 1.2.1). That extension ID is now deprecated in favor ofjohnrdorazio.vscode-phpcs. Please uninstall the old extension and install this one to receive future updates.
If you were using any of the previous extensions, you can safely uninstall them and switch to this one to receive continued updates.
Supports PHPCS versions 1.x, 2.x, 3.x, and 4.x.
Note: This extension requires a local Node.js runtime and does not work on web platforms (github.dev, vscode.dev). It needs to spawn PHPCS as a child process, which is not possible in browser-based environments.
For release notes and version history, see the Changelog.
Setup Development Version
Prerequisites
Installation
-
Clone this repository and check out the
developbranch -
Open the cloned repository folder using VS Code
-
Install dependencies from the root directory:
npm installThis runs
postinstallscripts that install dependencies for bothphpcs-server/andphpcs/subdirectories.
Building
To build the extension, run from the root directory:
npm run bundle # Production build (minified)
npm run bundle-dev # Development build (with sourcemaps)
This uses esbuild to bundle both the client and
server into single JavaScript files in phpcs/dist/.
To create a .vsix package for installation:
npm run package-prod # Production package (~177KB compressed)
npm run package-dev # Development package with sourcemaps (~388KB compressed)
Running Tests
npm test
This runs tests for both the server and client.
Run/Debug Development Version
To run the development version of the phpcs extension:
-
Open the cloned repository folder using VS Code
-
(Optional) Build the extension before debugging to ensure artifacts are ready:
npm run bundle-dev # One-time build # OR npm run bundle-watch # Continuous watch mode (auto-rebuilds on changes)Note: The debug configurations automatically start the watch tasks via
preLaunchTask, but runningbundle-devfirst ensures the initial build completes before the extension launches. -
Select sidebar option
Run and Debug(Ctrl+Shift+D) -
Select
Client + Serverfrom the Debug dropdown menu -
Press
Start Debugging(F5)
This will launch a new VS Code window named Extension Development Host,
automatically using the development version of the phpcs extension.
Note: If you don't have an open PHP file in the Extension Development Host, the server debug session will timeout and you will need to relaunch it from the debug panel.
Architecture
This extension uses the Language Server Protocol (LSP) architecture, which separates the extension into two components:
- Client (
phpcs/): The VS Code extension that communicates with the editor - Server (
phpcs-server/): A separate Node.js process that runs PHPCS and reports diagnostics
Why LSP?
The LSP architecture provides several benefits:
- Non-blocking linting: The server runs in a separate process, so heavy PHPCS operations don't freeze the VS Code UI
- Better resource isolation: Memory and CPU usage are isolated from the main extension host
- Standardized protocol: Uses the same protocol as other language servers, making the codebase more maintainable
Extension Size
This extension is larger (~650KB uncompressed) compared to simpler alternatives (~185KB) because it bundles the LSP libraries:
| Component | Size |
|---|---|
| vscode-languageclient | ~100KB |
| vscode-languageserver | ~80KB |
| vscode-languageserver-protocol | ~45KB |
| vscode-jsonrpc | ~35KB |
| Other dependencies | ~40KB |
| Extension code | ~10KB |
The trade-off is worth it: the LSP approach ensures VS Code remains responsive even when linting large files or projects with many PHP files.