1# PHP
2
3PHP support is available through the [PHP extension](https://github.com/zed-extensions/php).
4
5- Tree-sitter: https://github.com/tree-sitter/tree-sitter-php
6- Language Servers:
7 - [phpactor](https://github.com/phpactor/phpactor)
8 - [intelephense](https://github.com/bmewburn/vscode-intelephense/)
9
10## Choosing a language server
11
12The PHP extension offers both `phpactor` and `intelephense` language server support.
13
14`phpactor` is enabled by default.
15
16## Phpactor
17
18The Zed PHP Extension can install `phpactor` automatically but requires `php` to installed and available in your path:
19
20```sh
21# brew install php # macOS
22# sudo apt-get install php # Debian/Ubuntu
23# yum install php # CentOS/RHEL
24# pacman -S php # Arch Linux
25which php
26```
27
28## Intelephense
29
30[Intelephense](https://intelephense.com/) is a [proprietary](https://github.com/bmewburn/vscode-intelephense/blob/master/LICENSE.txt#L29) language server for PHP operating under a freemium model. Certain features require purchase of a [premium license](https://intelephense.com/). To use these features you must place your [licence.txt file](https://intelephense.com/faq.html) at `~/intelephense/licence.txt` inside your home directory.
31
32To switch to `intelephense`, add the following to your `settings.json`:
33
34```json
35{
36 "languages": {
37 "PHP": {
38 "language_servers": ["intelephense", "!phpactor", "..."]
39 }
40 }
41}
42```
43
44## PHPDoc
45
46Zed supports syntax highlighting for PHPDoc comments.
47
48- Tree-sitter: [claytonrcarter/tree-sitter-phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc)