PHP IntelliSense for VS Code - Deployment & Usage Guide
Prerequisites
For End Users
- Visual Studio Code (latest stable version recommended)
- PHP >= 7.0.0 (must be accessible in system PATH or configured via settings)
- Git (optional, for cloning sample projects)
For Development/Contribution
- Node.js (LTS version recommended)
- npm (comes with Node.js)
- Composer (PHP dependency manager)
- PHP >= 7.0.0 with CLI support
- Visual Studio Code with Extension Development support
- vsce (VS Code Extension CLI tool) for packaging:
npm install -g vsce
Installation
Option A: End User Installation (Marketplace)
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X/Cmd+Shift+X) - Search for "PHP IntelliSense" by Felix Becker
- Click Install
- Disable built-in PHP IntelliSense to avoid duplicate suggestions:
{ "php.suggest.basic": false }
Option B: Manual Installation (VSIX)
- Download the latest
.vsixfrom releases or build locally (see Build section) - In VS Code, go to Extensions view →
...menu → Install from VSIX - Select the downloaded file
Option C: Development Installation (Source)
-
Clone the repository:
git clone https://github.com/felixfbecker/vscode-php-intellisense.git cd vscode-php-intellisense -
Install PHP dependencies (language server):
composer install -
Install Node.js dependencies:
npm install
Configuration
Required Settings
Add to your VS Code settings.json (Ctrl+, then search settings):
| Setting | Description | Example |
|---|---|---|
php.executablePath | Path to PHP binary if not in PATH | "C:\\php\\php.exe" (Windows) or "/usr/bin/php" (Linux/Mac) |
php.memoryLimit | Memory limit for language server | "4095M" (default), "2G", or "-1" for unlimited |
Recommended Settings
{
"php.suggest.basic": false,
"php.executablePath": "/usr/bin/php",
"php.memoryLimit": "4095M"
}
Memory Limit Validation Rules:
- Must be numeric with optional suffix (
K,M,G) - Or
-1for unlimited - Examples:
512M,2G,4095M,-1
Environment Variables
Ensure php command is available in your shell PATH, or explicitly configure php.executablePath.
Build & Run
Development Workflow
-
Install dependencies:
composer install npm install -
Build the extension:
npm run build -
Launch Development Host:
- Open the project folder in VS Code:
code . - Press
F5to launch the Extension Development Host - A new VS Code window opens with the extension loaded
- Open any PHP file to test IntelliSense features
- Open the project folder in VS Code:
Working on the Language Server
The PHP language server is bundled via Composer in vendor/felixfbecker/language-server. To use a local development version:
- Clone the language server repository separately
- Replace the vendor directory with a symlink:
rm -rf vendor/felixfbecker/language-server ln -s /path/to/your/php-language-server vendor/felixfbecker/language-server
Production Build
Create a deployable VSIX package:
npm run build
vsce package
This generates a .vsix file for distribution.
Deployment
Publishing to VS Code Marketplace
-
Prerequisites:
- Azure DevOps Personal Access Token with Marketplace permissions
- Publisher account on VS Code Marketplace
-
Login:
vsce login <publisher-name> -
Publish:
vsce publishOr for specific version:
vsce publish patch # or minor/major
Enterprise/Offline Deployment
For air-gapped environments or enterprise distribution:
- Build the VSIX:
vsce package - Distribute the
.vsixfile via internal extension gallery or file share - Users install via Command Palette →
Extensions: Install from VSIX
CI/CD Integration (Travis CI)
The project uses Travis CI for automated builds (see .travis.yml):
- Builds run on every push/PR
- Semantic-release automates versioning and publishing
- Ensure
GH_TOKENandVSCE_TOKENare set in Travis environment variables
Troubleshooting
PHP Executable Not Found
Error: PHP executable not found. Install PHP 7 and add it to your PATH...
Solutions:
- Verify PHP installation:
php --version(should show >= 7.0.0) - Set explicit path in settings:
- Windows:
"php.executablePath": "C:\\php\\php.exe" - Linux/Mac:
"php.executablePath": "/usr/bin/php"
- Windows:
- Restart VS Code after changing settings
Invalid Memory Limit
Error: The memory limit you\'d provided is not numeric...
Solution: Use valid PHP shorthand notation:
- Correct:
"4095M","2G","-1" - Incorrect:
"4095 MB","unlimited"
PHP Version Compatibility
Error: Spawning PHP fails or features don't work
Check: Run php --version in terminal. Must be >= 7.0.0. The extension checks for semantic version ^7.0.0.
Duplicate Suggestions
Issue: Seeing double completion suggestions
Solution: Disable VS Code's built-in PHP IntelliSense:
{
"php.suggest.basic": false
}
Language Server Crashes
Symptom: Features stop working, high CPU usage
Solutions:
- Increase memory limit:
"php.memoryLimit": "-1"(unlimited) or"8G" - Check Output panel → "PHP IntelliSense" for stack traces
- Ensure no conflicting PHP extensions are installed (disable other IntelliSense providers)
Development: Extension Won't Launch
Issue: F5 doesn't open Extension Development Host
Solutions:
- Ensure
npm run buildcompleted without errors - Check that
composer installran successfully (vendor directory exists) - Verify TypeScript compilation: check
out/directory exists with compiled.jsfiles
Windows-Specific Issues
If using WSL or Cygwin paths, ensure php.executablePath uses Windows-style paths or WSL paths consistently with your VS Code environment.