Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>TemPHPestNew to Visual Studio Code? Get it now.
TemPHPest

TemPHPest

Liam Hammett

|
4,509 installs
| (3) | Free
Make writing PHP better
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TemPHPest logo

TemPHPest for VSCode

TemPHPest is an extension with one goal; make writing PHP in VSCode better. It does this through a number of features, each of which can be turned on or off in the settings.

You still need a language server like Intelephense to provide PHP language features like autocompletion and diagnostics, TemPHPest will provide additional features on top of that.

Features

Stubs

When creating a new file with the .php extension using the PSR Naming Conventions, the file will be filled out with an empty class/interface/trait/etc. based on the file's name.

There are also a handful of additional file stubs that are created beyond the standard PSR ones, such as abstract classes if the filename starts with "Abstract", enums if the filename ends with "Enum", Twig components if the file ends with a .twig extension and is in a component directory. It will also help to create PHPUnit, Laravel or Pest stubs depending on which testing framework you are using.

If the file is in a PSR-4 directory, it will also fill out the namespace in the newly created file.

Example creating a new file and having the template filled out

If you're using Laravel and make certain files in the expected directories, the extension will automatically fill out the new file with the stubs Laravel uses for the artisan make commands.

Additionally, if you prefer to use PHP's declare(strict_types=1) in your code, there's an option to add that to all new files by default.

Auto Renaming

When moving or renaming a file in a PSR-4 directory, the class name and namespace inside the file will update to match. The extension can also update all other references to the class in the workspace.

Copying and pasting a file will also update the name/namespace to match. If copying a file in the same directory, you'll be asked for a new class name.

Code Actions

In several scenarios, the extension provides "code actions". These are suggestions to help refactor and improve your code.

Right now there are a limited number of code actions available, but this will grow with time.

Example of code actions and quick fixes changing code

Auto Switch to PHP Language

If you type <?php in an empty file, the file's language will automatically switch to PHP. This is particularly useful if coding in a scratch-file.

Automatic switching to PHP language in a scratch file

Auto Interpolate

When it looks like you're trying to interpolate a variable inside a single-quote string, for example typing 'Hello {$name}', the extension will automatically switch the surrounding quotes to use double-quotes so the interpolation will work.

Example of automatic switching from single quotes to double quotes

This also works with nowdoc strings, for example typing <<<'EOT'Hello {$name}EOT will automatically switch the surrounding quotes to use double-quotes.

Surround With Snippets

When using the "Surround with Snippet..." command, the extension provides a handful of snippets to use. This allows you to quickly wrap selected code in if statements, try/catch statements, closures, and much more.

Snippets are provided for PHP, Twig and Blade syntax.

Example using the "Surround with Snippet" command

Explorer File Nesting

VSCode allows files to be visually nested in the explorer view when in the same folder, helping to group them and treat them like a folder, which saves space in the explorer view.

The extension automatically nests some common files, such as composer.lock in composer.json, and psalm-baseline.xml in psalm.xml.

REPL

REPL (Read-Eval-Print Loop) can be enabled on a file to automatically execute the code as you write, showing the output of each value inline. This is powerful for quickly testing code snippets in scratch files.

Example of the REPL showing results

Date Formatting Lens

When viewing a PHP file, the extension will show a lens above any date() function calls, showing the date that will be output by the function.

Smart Autocompletion

  • When typing in a date-related function like date(), you will be prompted with a list of characters that can be used in the format string, with descriptions and examples.

Blade: Heredoc/Nowdoc Syntax Highlighting

When using the "BLADE" tag in heredoc and nowdoc strings, the contents will be correctly highlighted as Blade syntax. (Note that you still need an extension to provide Blade syntax highlighting.)

Heredoc string showing Blade syntax highlighting

Twig: Links

When in a file with a .twig extension, any {% include %}, {% extends %}, {% block %} and <twig:Component> statement will become a link, allowing you to click through and navigate Twig files quickly.

Twig: Component Completion

When in a file with a .twig extension, typing <twig: will trigger a list of component suggestions found in the workspace.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft