Interactive setup for PHP LSP development environment
Sets up a complete PHP LSP development environment with Phpactor, PHP-CS-Fixer, PHPStan, Psalm, and PHPCS. Use this when you need to enable intelligent code completion, diagnostics, and formatting for PHP projects in Claude Code.
/plugin marketplace add zircote/php-lsp/plugin install php-lsp@zircote-lspThis command will configure your PHP development environment with Phpactor and essential tools.
First, verify PHP is installed:
php --version
composer --version
composer global require phpactor/phpactor
# Formatting
composer global require friendsofphp/php-cs-fixer
# Static analysis
composer global require phpstan/phpstan
composer global require vimeo/psalm
# Linting
composer global require squizlabs/php_codesniffer
phpactor --version
php-cs-fixer --version
phpstan --version
export ENABLE_LSP_TOOL=1
Test the LSP integration:
# Create a test file
echo '<?php function greet(string $name): string { return "Hello, $name!"; }' > test_lsp.php
# Run PHP-CS-Fixer
php-cs-fixer fix test_lsp.php
# Run PHPStan
phpstan analyse test_lsp.php
# Clean up
rm test_lsp.php