Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tal7aouy/php-snippets-for-vscode

Snippet pack for developers to speed up programming with PHP!
https://github.com/tal7aouy/php-snippets-for-vscode

php snippets visual-studio-code

Last synced: 28 days ago
JSON representation

Snippet pack for developers to speed up programming with PHP!

Awesome Lists containing this project

README

        

# PHP snippets

[![Version](https://vsmarketplacebadge.apphb.com/version/tal7aouy.php.svg)](https://marketplace.visualstudio.com/items?itemName=tal7aouy.php)
[![Installs](https://vsmarketplacebadge.apphb.com/installs-short/tal7aouy.php.svg)](https://marketplace.visualstudio.com/items?itemName=tal7aouy.php)
[![Ratings](https://vsmarketplacebadge.apphb.com/rating/tal7aouy.php.svg)](https://marketplace.visualstudio.com/items?itemName=tal7aouy.php)

[![Maintainability](https://api.codeclimate.com/v1/badges/4f02368ebeb7be1490bb/maintainability)](https://codeclimate.com/github/php/php/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/4f02368ebeb7be1490bb/test_coverage)](https://codeclimate.com/github/php/php/test_coverage)

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

## Installation

1. Open the extensions sidebar on Visual Studio Code
1. Search for php snippets
1. Click Install
1. 🌟🌟🌟🌟🌟 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 '

';\nvardump($ex); \necho '
';` 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](https://github.com/tal7aouy/php-snippets-for-vscode/issues).

---

Happy coding **_ PHP developer _**

---