PHPackages                             phpactor/language-server-protocol - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpactor/language-server-protocol

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phpactor/language-server-protocol
=================================

Langauge Server Protocol for PHP (transpiled)

3.17.5(4mo ago)12462.7k↓44.4%2[2 PRs](https://github.com/phpactor/language-server-protocol/pulls)3MITPHPPHP ^7.3 || ^8.0CI failing

Since Jul 31Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/phpactor/language-server-protocol)[ Packagist](https://packagist.org/packages/phpactor/language-server-protocol)[ RSS](/packages/phpactor-language-server-protocol/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (19)Used By (3)

PHP Language Server Protocol Generator
======================================

[](#php-language-server-protocol-generator)

[![CI](https://github.com/phpactor/language-server-protocol/workflows/CI/badge.svg)](https://github.com/phpactor/language-server-protocol/workflows/CI/badge.svg)

This package *transpiles* the `vscode-language-server-protocol` library to PHP, providing the protocol classes required to create Language Server with PHP.

Notes on using the library
--------------------------

[](#notes-on-using-the-library)

Most (if not all) of the upstream Typescript types have no constructors, therefore the argument order of the constructors can change on *every release*.

It is therefore **strongly recommended** to use named arguments.

Generation
----------

[](#generation)

Generating the code:

- `npm run generate`: Build and transpile
- `npm run watch`: Watch and compile on Typescript changes.

Running the PHP tests:

- `composer integrate`

Usage
-----

[](#usage)

### Deserialization

[](#deserialization)

This library will use the type information form typescript to generate `fromArray` static constructors for each type:

```
$item = CompletionItem::fromArray([
    'label' => 'Foobar',
    'kind' => 1,
    'detail' => 'This is foobar',
    'documentation' => [
        'kind' => 'markdown',
        'value' => 'Foobar',
    ],
    'additionalTextEdits' => [
        [
            'range' => [
                'start' => [
                    'line' => 5,
                    'character' => 10,
                ],
                'end' => [
                    'line' => 10,
                    'character' => 10,
                ],
            ],
            'newText' => 'Foobar',
        ],
    ],
    'command' => [
        'title' => 'Foobar',
        'command' => 'my.command',
    ],
]);

```

Will return a fully hydrated completion item with concrete sub-types.

**NOTE**: that when deserializing from a language server client request, it is probably a good idea to ignore additional parameters (the second argument to `fromArray`). This is because it is perfectly valid to pass unknown properties to some of the LSP objects.

### Serialization

[](#serialization)

Properties in classes are public to enable JSON serialization. Call `json_encode($lspObject)` to get the valid LSP JSON object.

Contributing
------------

[](#contributing)

This package is open source and welcomes contributions! Feel free to open a pull request on this repository.

Support
-------

[](#support)

- Create an issue on the main [Phpactor](https://github.com/phpactor/phpactor) repository.
- Join the `#phpactor` channel on the Slack [Symfony Devs](https://symfony.com/slack-invite) channel.

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance77

Regular maintenance activity

Popularity43

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 94.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~164 days

Recently: every ~263 days

Total

13

Last Release

140d ago

Major Versions

0.1.0 → 3.16.0.x-dev2021-02-04

0.3.1 → 3.17.x-dev2022-05-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/24ec7d5d6b7ea54007be5d7b4f43800381cc1e22929f7d2276fba30e497fdfa6?d=identicon)[dantleech](/maintainers/dantleech)

---

Top Contributors

[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (92 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![zonuexe](https://avatars.githubusercontent.com/u/822086?v=4)](https://github.com/zonuexe "zonuexe (2 commits)")[![zobo](https://avatars.githubusercontent.com/u/2456026?v=4)](https://github.com/zobo "zobo (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpactor-language-server-protocol/health.svg)

```
[![Health](https://phpackages.com/badges/phpactor-language-server-protocol/health.svg)](https://phpackages.com/packages/phpactor-language-server-protocol)
```

###  Alternatives

[pyrech/composer-changelogs

Display changelogs after each composer update

5904.0M25](/packages/pyrech-composer-changelogs)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.8k15.7k](/packages/phpactor-phpactor)[geocoder-php/plugin

Plugins to Geocoder providers

705.1M2](/packages/geocoder-php-plugin)[phpactor/language-server

Generic Language Server Platform

55470.1k6](/packages/phpactor-language-server)[dantleech/gherkin-lint

Gherkin linter

46177.5k11](/packages/dantleech-gherkin-lint)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
