cargo build --release # build the binary- Rust (stable toolchain)
The build.rs script automatically fetches the latest JetBrains phpstorm-stubs from GitHub and embeds them directly into the binary. This gives the LSP full knowledge of built-in PHP classes, functions, and constants with no runtime dependencies.
The stubs are downloaded on first build and cached in stubs/. To update to the latest stubs, delete the stubs/ directory and rebuild.
For details on how symbol resolution and stub loading work, see ARCHITECTURE.md.
Run the full test suite:
cargo testBefore submitting changes, run exactly what CI runs:
cargo test
cargo clippy -- -D warnings
cargo clippy --tests -- -D warnings
cargo fmt --check
php -l example.php
php -d zend.assertions=1 example.phpAll six must pass with zero warnings and zero failures.
The included test_lsp.sh script sends JSON-RPC messages to the server over stdin/stdout, exercising the full LSP protocol flow (initialize, open file, hover, completion, shutdown):
./test_lsp.shThis is useful for verifying end-to-end behavior outside of an editor.
Enable logging by setting the RUST_LOG environment variable:
RUST_LOG=debug cargo run 2>phpantom.logLogs are written to stderr, so redirect as needed.
For editor setup instructions, see SETUP.md.