Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>PHP file generatorNew to Visual Studio Code? Get it now.
PHP file generator

PHP file generator

Åsmund Stavdahl

|
553 installs
| (0) | Free
Generate basic content for classes, interfaces and traits based on project context
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-php-filegen

Generate basic content of class/interface/trait files based on the project context.

Features

  • Generate a namespaced class/interface/trait in an empty file based on the project context.
  • Decides what to generate based on the filename
    • Files starting with "i" get an interface generated (iInterfaceName.php => interface iInterfaceName)
    • Files starting with "t" get a trait generated (tTraitName.php => trait tTraitName)
    • Other files get a class generated (SomeClass.php => class SomeClass)

Generate namespaced class

Requirements

  1. your source files must be in the src directory
  2. your project must be PSR-4 autoloading configured in composer.json
  3. currently, your PSR-4 autoloading for src must be the first namespace of autoload.psr-4 in composer.json

Extension Settings

No settings available at this point.

Known Issues

Quirky base namespace inference from composer.json.

Release Notes

Release nooooooooootesah.

0.1.2

Don't add "namespace ;" to files in the root namespace.

0.1.0

New setting for composer.json location.

0.0.1

Initial release.

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