LSP PHP
Semantic code navigation for PHP and Laravel projects — go-to-definition, find-references, diagnostics, and hover.
@elyracode/lsp-php starts a PHP language server per session in any project containing a composer.json and exposes the Language Server Protocol as agent tools. This gives the model the same semantic understanding your IDE has — exact symbol locations, type information, and real diagnostics — instead of relying on text search and guesswork.
It uses Intelephense by default, with a phpactor fallback.
Install
elyra install npm:@elyracode/lsp-php
The extension activates automatically in any project with a composer.json in its root. It looks for a configured language server (Intelephense, falling back to phpactor) and does nothing if neither is available.
Tools
| Tool | Description |
|---|---|
php_definitions |
Go to the definition of a symbol at a given file position |
php_references |
Find all references to a symbol across the project |
php_diagnostics |
Get PHP errors and warnings for a file |
php_hover |
Get type information and documentation for a symbol |
All tools accept 1-based line and column numbers and return human-readable text results.
Examples
> Where is the `handle` method of the SyncElyraDocs command defined?
> Find every call site of `ConductorReleaseInfo::current` in this repo
> What PHP errors does app/Services/ElyraSkillsRegistry.php have?
> What is the return type of `User::teams()` on line 42 of User.php?
Why use it
- Accuracy — definitions and references come from the language server, not regex
- Refactors that don't miss call sites —
php_referencesenumerates every usage before edits - Real diagnostics — surface type and syntax errors without running a full build
- Hover types — inspect inferred types and PHPDoc without opening the file in an editor