DEVSENSE PHP Language Server#
This package provides language server for PHP.
🧠 Language Server#
The language server is provided as a platform-specific binary executable file, located in node_modules/devsense-php-ls-${os}-${cpu}/dist/devsense.php.ls.
The functionality is provided to end-users under a freemium model. See 🔐 Activation section below for details.
🧬 Protocol#
The language server is controlled using the Language Server Protocol according to https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/ through STDIN/STDOUT.
There are several additions:
"initialize"method, parameter:
{
"initializationOptions": {
"0": "KEY or {JSON CODE}",
"clientFeatures": [],
// VSCode settings and their values listed on
// https://docs.devsense.com/vscode/configuration/
// "setting-id": "value",
},
// process ID of client allowing
// LS to automatically kill itself if client exits
"processId": 123456,
// ...
}
Command-Line Arguments#
-version,-v: Prints application version information.-composerNodes: Enable or disable composer nodes caching. Default istrue.-parallelism: Number of threads used for indexing and analysis. Default is the number of CPU cores *2.-lsp-log: Output path to the language server protocol log.-mcp: If specified, this language server process will also act as a Model Context Protocol Server. The server will listen on 127.0.0.1 at random available port if not specified with --mcp-server-port. The actual port number will be returned by the language server initialize response.-mcp-server-port: Specifies the port number the MCP server will listen on. Otherwise a random available port will be used
Enabling MCP Server#
The language server process can act as MCP Server (MCP through http transport stream). This enables tools for AI agents providing semantic information about your workspace.
Start the language server process with -mcp and -mcp-server-port <number> arguments:
devsense-php-ls -mcp -mcp-server-port 9101
Example mcp.json:
🔐 Activation#
The language server provides free features and premium features which needs to be activated by end-user.
Note to developers: To unlock the premium features of this package, instruct end-users to follow the steps below:
-
Purchase a License: User needs to purchase license on official purchase page: https://www.devsense.com/purchase
-
Activate Language Server
Set the value of license key into DEVSENSE_PHP_LS_LICENSE environment variable or "initializationOptions"."0". Language Server will try to activate automatically upon starting (requires Internet connection).
- Optional: Offline Activation
In case there is no Internet connection: User will follow the link below to validate license and receive a {JSON CODE}: devsense.com/purchase/validation
Pass the entire {JSON CODE} into the language server's initialize method, as a "initializationOptions"."0" property:
Or store the {JSON CODE} into environment variable DEVSENSE_PHP_LS_LICENSE.
If you encounter any issues during the activation process, please refer to our documentation or contact support.
📜 Agreement#
By including this package as a dependency in your project—whether for personal, commercial, or open-source use—you agree to the following:
- Attribution is required: You must include a visible link to this README file in your project documentation (e.g. in your
README.md, about page, or developer docs). -
This is to ensure that end users and developers are aware:
-
Who the original authors and maintainers of this package are
- How to access premium features, including purchasing and activation steps
This visibility helps support ongoing development and ensures fair use under our freemium model.
If you cannot comply with this requirement or need a custom license, please contact us for a commercial agreement.