PHP Companion
This extension allows to easily create new PHP class, run test, insert namespace, etc.
Features
- Create PHP class file content
- Read Namespace from composer.json
- Insert namespace for a file
- Add extends PHPUnit TestCase to classes wich names ends with "Test"
- Declare an interface if name ends with "Interface"
- Add command and Keybindings to easily run tests
- Open tests logs in a virtual document
- PHP Refactoring support : "Extract method" and "Extract variable"
Create new PHP files
From explorer, right click on a folder and select "New PHP Class"

See FAQ to read more about generated namespace
Insert namespace in PHP files
Select text or move cursor to the desired position and right click, then choose "Insert namespace" menu item

Refactoring
Select text and click on the bulb icon to choose wich refactoring to apply

Snippets
Type con to generate class constructor :
public function __construct(Type $param)
{
$this->param = $param;
}
Type prop to generate class property :
private Type $;
Type fun to generate class method :
public function functionName(Type $param): void
{
}
Type cop to generate class constructor with property (php >= 8.0 required) :
public function __construct(
private Type $param
) {
}
Easily run tests
Hit F9 (default keybindings) or select the command to run tests

Tests will be executed, and results will be shown in statusbar

Click "Open tests logs" and see what happened
