You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/SETUP.md
+49-44Lines changed: 49 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,43 +57,12 @@ This creates a `.phpantom.toml` in the current directory. Currently supported se
57
57
58
58
The file is optional. When absent, all settings use their defaults. New settings will be added as features land. Unknown keys are silently ignored, so the file is forward-compatible.
59
59
60
-
### Indexing Strategy
61
-
62
-
By default, PHPantom trusts Composer's autoloader to determine which classes exist in your project. This is intentional: it means completions, diagnostics, and go-to-definition reflect what your code will actually see at runtime. Classes that aren't autoloadable don't appear, because using them would be an error.
63
-
64
-
The `strategy` setting controls this behaviour:
65
-
66
-
| Strategy | Behaviour |
67
-
| --- | --- |
68
-
|`"composer"` (default) | Use Composer's classmap when available, self-scan to fill gaps. Results match what `composer dump-autoload` knows about. |
69
-
|`"self"`| Ignore Composer's classmap entirely and scan every PHP file in the workspace. Discovers all classes regardless of autoloading. |
70
-
|`"none"`| Use only Composer's classmap with no fallback scanning. The most conservative option. |
71
-
72
-
Most projects should leave this at the default. Change it to `"self"` if your project loads classes outside of Composer (custom autoloaders, `require_once`, legacy inclusion patterns). Be aware that `"self"` will also surface vendor-internal classes and potential duplicates that Composer's autoloader would never load.
73
-
74
-
## Troubleshooting
75
-
76
-
### Classes from other files are not found
77
-
78
-
PHPantom resolves cross-file classes through Composer's autoloading rules (PSR-4 mappings and the generated classmap). If a class exists in your project but PHPantom reports it as unknown, the most common causes are:
79
-
80
-
1.**The class isn't Composer-autoloadable.** If your project loads classes via `require_once`, `include`, or a custom autoloader alongside Composer, those classes won't be discovered by default. Set `strategy = "self"` in `.phpantom.toml` to scan all files.
81
-
82
-
2.**Composer's classmap is stale.** Run `composer dump-autoload` to regenerate it. PHPantom reads the classmap at startup.
83
-
84
-
3.**The class is in a directory not covered by `autoload` or `autoload-dev`.** Check that your `composer.json` PSR-4 mappings cover the directory where the class lives.
85
-
86
-
### Too many classes in completion lists
87
-
88
-
If you're seeing vendor-internal classes, duplicate framework classes (common in monorepos), or other noise, your indexing strategy may be too broad. The default `"composer"` strategy only surfaces classes that Composer's autoloader can load, which filters out this noise. If you previously set `strategy = "self"`, consider switching back to `"composer"`.
89
-
90
60
## Editor Setup
91
61
92
62
PHPantom communicates over stdin/stdout using the standard [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). Any editor with LSP support can use it. Point the client at the `phpantom_lsp` binary with `php` as the file type. No special initialization options are required.
93
63
94
-
---
95
-
96
-
### Zed
64
+
<details>
65
+
<summary><b>Zed</b></summary>
97
66
98
67
A Zed extension is included in the `zed-extension/` directory:
99
68
@@ -116,9 +85,10 @@ To make PHPantom the default PHP language server, add to your Zed `settings.json
* Mapping: set `PHP` on both the **Language** tab and the **File Type** tab (the dialogs are identical). Setting both ensures PHPStorm activates the server reliably.
176
148
177
-
<img width="779" height="645" alt="Screenshot From 2026-02-21 00-28-37" src="https://github.com/user-attachments/assets/2da88e68-d012-476e-82e7-977dbfcd9653" />
149
+
<img width="779" height="645" alt="PHPStorm new language server dialog" src="https://github.com/user-attachments/assets/2da88e68-d012-476e-82e7-977dbfcd9653" />
178
150
179
-
<img width="779" height="645" alt="Screenshot From 2026-02-21 00-32-24" src="https://github.com/user-attachments/assets/62358f9e-973c-487d-ac17-098d7dab007e" />
151
+
<img width="779" height="645" alt="PHPStorm language server mapping dialog" src="https://github.com/user-attachments/assets/62358f9e-973c-487d-ac17-098d7dab007e" />
180
152
181
-
---
153
+
</details>
182
154
183
-
### Sublime Text
155
+
<details>
156
+
<summary><b>Sublime Text</b></summary>
184
157
185
158
> [!NOTE]
186
159
> This configuration is untested. If you get it working (or run into issues), please [open an issue](../../issues).
@@ -198,3 +171,35 @@ With [LSP for Sublime Text](https://github.com/sublimelsp/LSP):
198
171
}
199
172
}
200
173
```
174
+
175
+
</details>
176
+
177
+
## Indexing Strategy
178
+
179
+
By default, PHPantom trusts Composer's autoloader to determine which classes exist in your project. This is intentional: it means completions, diagnostics, and go-to-definition reflect what your code will actually see at runtime. Classes that aren't autoloadable don't appear, because using them would be an error.
180
+
181
+
The `strategy` setting controls this behaviour:
182
+
183
+
| Strategy | Behaviour |
184
+
| --- | --- |
185
+
|`"composer"` (default) | Use Composer's classmap when available, self-scan to fill gaps. Results match what `composer dump-autoload` knows about. |
186
+
|`"self"`| Ignore Composer's classmap entirely and scan every PHP file in the workspace. Discovers all classes regardless of autoloading. |
187
+
|`"none"`| Use only Composer's classmap with no fallback scanning. The most conservative option. |
188
+
189
+
Most projects should leave this at the default. Change it to `"self"` if your project loads classes outside of Composer (custom autoloaders, `require_once`, legacy inclusion patterns). Be aware that `"self"` will also surface vendor-internal classes and potential duplicates that Composer's autoloader would never load.
190
+
191
+
## Troubleshooting
192
+
193
+
### Classes from other files are not found
194
+
195
+
PHPantom resolves cross-file classes through Composer's autoloading rules (PSR-4 mappings and the generated classmap). If a class exists in your project but PHPantom reports it as unknown, the most common causes are:
196
+
197
+
1.**The class isn't Composer-autoloadable.** If your project loads classes via `require_once`, `include`, or a custom autoloader alongside Composer, those classes won't be discovered by default. Set `strategy = "self"` in `.phpantom.toml` to scan all files.
198
+
199
+
2.**Composer's classmap is stale.** Run `composer dump-autoload` to regenerate it. PHPantom reads the classmap at startup.
200
+
201
+
3.**The class is in a directory not covered by `autoload` or `autoload-dev`.** Check that your `composer.json` PSR-4 mappings cover the directory where the class lives.
202
+
203
+
### Too many classes in completion lists
204
+
205
+
If you're seeing vendor-internal classes, duplicate framework classes (common in monorepos), or other noise, your indexing strategy may be too broad. The default `"composer"` strategy only surfaces classes that Composer's autoloader can load, which filters out this noise. If you previously set `strategy = "self"`, consider switching back to `"composer"`.
0 commit comments