Skip to content

Commit cdbd123

Browse files
committed
docs: php intelliphense config
1 parent 350567e commit cdbd123

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

docs/07-Code Intelligence/02-php.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The free version of Intelephense covers everything described above. If you own a
3131

3232
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.
3333

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.
3535

3636
**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):
3737

@@ -43,7 +43,15 @@ Fix this by dropping an `intelephense.config.json` file in your project root, th
4343
}
4444
```
4545

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.
4755

4856
> 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.
4957
@@ -57,7 +65,9 @@ Install the stubs with Composer first, e.g. `composer require --dev php-stubs/wo
5765
}
5866
```
5967

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.
6171

6272
## Running PHP Pages
6373

0 commit comments

Comments
 (0)