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

PHP Snippets

Mhammed Talhaouy

|
23,599 installs
| (1) | Free
Snippet pack for developers to speed up programming with PHP!
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PHP snippets

Version Installs Ratings

Maintainability Test Coverage

This extension contains code snippets for [Vs Code][code] editor (supports PHP).

Installation

  1. Open the extensions sidebar on Visual Studio Code
  2. Search for php snippets
  3. Click Install
  4. 🌟🌟🌟🌟🌟 Rate five-stars 😃

The languages supported (file extensions)

  • PHP (.php)

Snippets

Snippets are optimized to be short and easy to remember.

Below is a list of all available snippets and the triggers of each one. The ⇥ means the TAB key.

Import and export

Trigger Content
eco⇥ echo ""; statement.
pri⇥ print($ex); statement.
dump⇥ var_dump($ex) statement
pre_dump⇥ echo '<pre>';\nvardump($ex); \necho '</pre>'; formated var_dump output
fore⇥ foreach(iterable_expr as $value) {...}
forek⇥ foreach(iterable_expr as $key => $value) {...
prif⇥ private function name() {}
prisf⇥ private static function name() {}
prof⇥ protected function name() {}
prosf⇥ protected static function name() {}
pubf⇥ public function name() {}
pubsf⇥ public static function name() {}
fn⇥ fn($x) => $x * 10 Arrow function
inc⇥ include $file include filename
inco⇥ include_one $file include_one filename
req⇥ require $file require filename
reqo⇥ require_once $file require_once filename
thr⇥ throw new $0 throw an exception
ns⇥ namespace App; namespace App is an example
mt⇥ match($ex) {...} match expression
G⇥ $_GET['var'] $_GET Superglobal
P⇥ $_POST['var'] $_POST Superglobal
SE⇥ $_SERVER['var'] $_SERVER Superglobal
SESS⇥ $_SESSION['var'] $_SESSION Superglobal
REQ⇥ $_REQUEST['var'] $_REQUEST Superglobal
FI⇥ $_FILE['var']['name'] $_FILE Superglobal

Issues & Suggestions

For any issues or suggestions, please use GitHub issues.


Happy coding _ PHP developer _


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