.php, .phtml, .phpt and older .php3–.php5, plus files starting with <?php or a php shebang) out of the box. Completion, navigation, refactoring and diagnostics come from Intelephense. Composer scripts and PHPUnit/Pest suites are detected as run configurations, and Xdebug sessions run through the PHP Debug adapter. See the support matrix for other languages.
Language servers
Intelephense checks code against the project’s PHP version (see Language level) and indexes the stubs and include paths you configure.
Setup
Installing the tools
When a.php file opens and Intelephense is missing, a notification offers Install. The IDE installs it with npm into its own tools folder (needs npm or pnpm on PATH). Everything is also listed in Settings › Languages & Frameworks › Language Servers.
PHP interpreter
Settings › Languages & Frameworks › PHP, section CLI Interpreter:- PHP interpreter: the
phpthat runs scripts, PHPUnit, Composer,artisanand PHP-based servers such as phpactor. Default usesphponPATH. Its folder is put first onPATH, sovendor/bin/phpunitand other#!/usr/bin/env phpscripts use the same PHP. The list includes PHP found onPATH(also versioned binaries likephp8.3), Homebrew, phpbrew, phpenv, Laravel Herd, and on Windows XAMPP and Laragon. - Run in target: run PHP and Composer commands locally or in a run target from Settings › Build, Execution, Deployment › Run Targets.
- The page shows the selected PHP’s version and the loaded Xdebug version (or Not installed).
Language level
PHP language level on the same page sets the version Intelephense checks against (5.6 to 8.5); newer syntax and functions are reported. Auto usesconfig.platform.php from composer.json, else the lowest version require.php allows. The status bar shows the current level; click it to switch.
Also on this page:
- Include paths: folders outside the project that Intelephense indexes too, such as a platform your module extends.
- Additional stubs: Intelephense stub sets on top of its defaults (for example
wordpress). Eachext-*inrequire/require-devofcomposer.jsonadds its own stubs automatically.
Composer
In a Composer project withoutvendor/, or whose installed packages differ from composer.lock, a banner “Composer dependencies are not installed” appears above PHP files and composer.json, with Install (runs composer install on the configured PHP) and Ignore.
Static analysis and formatting
- PHPStan: when the project has
vendor/bin/phpstan, saved files are checked with it and its findings appear as diagnostics. The PHPStan › Configuration file setting picks the config; empty usesphpstan.neon,phpstan.neon.distorphpstan.dist.neonin the project root. - PHP-CS-Fixer: when a folder above the file has
.php-cs-fixer.phpor.php-cs-fixer.dist.phpand the project hasvendor/bin/php-cs-fixer, Reformat Code (⌥⌘L/Ctrl+Alt+L) uses PHP-CS-Fixer instead of the language server.
Run and test
Detected when the project hascomposer.json or a PHPUnit configuration:
composer <script>for each script incomposer.json(Composer event hooks are skipped); a script namedtestis a test configuration.- PHPUnit (or Pest, when
vendor/bin/pestexists) when there isphpunit.xml,phpunit.xml.dist,phpunit.dist.xml, aphpunit/phpunitorpestphp/pestdependency, or a runner invendor/bin. artisan servein Laravel projects.
⌃⇧R / Ctrl+Shift+F10) runs a *Test.php file through the PHPUnit configuration, and any other PHP file with the selected interpreter. In *Test.php files and files under test/ or tests/, gutter icons run a single test class or method, or a Pest test. Results appear in the test tree with Rerun Failed Tests. See Testing.
Debugging
Debugging uses PHP Debug (vscode-php-debug) with Xdebug. The selected PHP must load the Xdebug extension; the PHP settings page shows whether it does.- Debug works on PHP files, PHPUnit/Pest and
artisan serve. The IDE turns on Xdebug for the session with-doptions and a free port, so you don’t need to editphp.ini, and another IDE listening on 9003 doesn’t conflict. - PHP Remote Debug (Xdebug) is a run configuration type that listens for incoming Xdebug connections (default port 9003), for requests served elsewhere such as php-fpm or a container. Its Start the remote side with field shows the matching
php -dxdebug.mode=debug …command; for web requests use theXDEBUG_SESSIONcookie or query parameter. Set Local root and Remote root to map paths.
Framework support
- Laravel: Laravel LSP for
config(),route()andview()strings, and anartisan serveconfiguration. - WordPress and similar platforms: add their stubs under Additional stubs and the platform folder under Include paths.
Limitations
- No Blade or Twig template support; only
.phpfiles get PHP code insight. - phpactor is not installed by the IDE.
- Run with Coverage is not available for PHPUnit.
- Debugging needs the Xdebug extension in your PHP; the IDE does not install it.