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/07-Code Intelligence/02-php.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ The free version of Intelephense covers everything described above. If you own a
31
31
32
32
PHP code intelligence only knows about the PHP files it can see. If your project is a WordPress theme or plugin (or any codebase that leans on functions/constants defined by a framework you don't have locally, like `get_header()`), those calls show up as **"Undefined function"** errors in the [Problems panel](/docs/Features/Problems%20Panel/ESLint) even though the code is correct.
33
33
34
-
Fix this by dropping an `intelephense.config.json` file in your project root, then restart Phoenix Code so PHP code intelligence picks it up.
34
+
Fix this by dropping an `intelephense.config.json` file in your project root, then restart Phoenix Code (or switch between projects) so PHP code intelligence picks it up.
35
35
36
36
**Recommended: point it at the framework's stub files** so the functions are actually recognized (you get real hover info and completions, not just silence):
37
37
@@ -43,7 +43,15 @@ Fix this by dropping an `intelephense.config.json` file in your project root, th
43
43
}
44
44
```
45
45
46
-
Install the stubs with Composer first, e.g. `composer require --dev php-stubs/wordpress-stubs` for WordPress. Similar stub packages exist for WooCommerce, Laravel, and other frameworks.
46
+
Install the stubs with Composer first. Open **View > Terminal** for a terminal already rooted at your project (same steps on Windows, macOS, and Linux), then run:
47
+
48
+
```bash
49
+
composer require --dev php-stubs/wordpress-stubs
50
+
```
51
+
52
+
> Needs [Composer](https://getcomposer.org/download/) installed. If the command isn't found, install Composer first (its site has steps for Windows, macOS, and Linux).
53
+
54
+
Similar stub packages exist for WooCommerce, Laravel, and other frameworks.
47
55
48
56
> Composer puts the stubs inside your project (`vendor/…`), so the path above works as-is on Windows, macOS, and Linux. Pointing `includePaths` at your actual local WordPress install instead would work too, but the path is different for every setup (XAMPP, MAMP, Local, Docker, …) and you'd have to track it down yourself — the stub package sidesteps that entirely.
49
57
@@ -57,7 +65,9 @@ Install the stubs with Composer first, e.g. `composer require --dev php-stubs/wo
57
65
}
58
66
```
59
67
60
-
> Commit `intelephense.config.json` to your repo so the whole team gets the same settings. See the [configuration reference](https://intelephense.com/docs) for the full list of `diagnostics` and `environment` options.
68
+
> This only silences the error. Code intelligence still doesn't know what these functions are, so you won't get hover docs or autocomplete for them — use the stub option above for that.
69
+
70
+
Commit `intelephense.config.json` to your repo so the whole team gets the same settings. See the [configuration reference](https://intelephense.com/docs) for the full list of `diagnostics` and `environment` options.
0 commit comments