Intelephense is a high-performance PHP language server that provides robust IDE features such as code completion, parameter hints, diagnostics, formatting, and symbol navigation. It supports PHP 7 and 8, offering comprehensive static analysis and accurate type inference for modern PHP projects. While widely recognized as a VS Code extension, the `intelephense` npm package specifically distributes the command-line interface (CLI) of the language server. This CLI enables integration with various Language Server Protocol (LSP) clients beyond VS Code or facilitates its use in automated workflows like CI/CD pipelines for linting and diagnostics. Currently at version 1.16.5 on npm, the project is actively developed, ensuring regular updates to support new PHP features and maintain compatibility with evolving editor integrations. Its primary differentiators include its speed, detailed static analysis tailored for PHP, and a rich feature set that significantly enhances PHP development experience.
npm install intelephenseVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install Intelephense locally, create a sample PHP file, and then programmatically run diagnostics on it using Node.js's `child_process` module to capture and parse the output.
Purchase a premium license from the official Intelephense website (intelephense.com) and configure it in your editor or via the server's configuration files if applicable.
Ensure PHP (version 7 or higher) is installed on your system and its executable directory is included in your system's PATH environment variable. Verify by running `php -v` in your terminal.
Check the Intelephense documentation for recommended stub configurations and ensure the `storagePath` is set to a writable directory for caching and indexing. For VS Code users, these are typically configured in `settings.json`.
It is highly recommended to use Intelephense versions 1.0 or higher for stability and modern PHP support. Consult the changelog for specific migration steps if upgrading from pre-1.0 versions.
If installed globally (`npm i -g intelephense`), ensure npm's global bin directory is in your PATH. If installed locally, run `npx intelephense` or add `node_modules/.bin` to your PATH for script execution.
Install PHP (version 7 or later) and verify it's added to your system's PATH. You can test by running `php -v` in your terminal.
Ensure the directory specified by `intelephense.storagePath` (or the default storage location) has write permissions for the user running Intelephense. You might need to change directory permissions or specify a different storage path.
Verify your `intelephense.stubs` setting includes all necessary PHP extensions you are using (e.g., `['php', 'json', 'pcre', 'standard', 'wordpress']`). Ensure your PHP installation and extensions are up-to-date and correctly configured.