├── .gitignore ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── img ├── php-awesome-icon.png └── snipdemo.gif ├── package.json └── snippets ├── array.json ├── class.json ├── control.json ├── error.json ├── function.json ├── function.php5.json ├── globalvar.json ├── loop.json ├── method.json ├── method.php5.json ├── statement.json └── tag.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Files 2 | *.orig 3 | *.php 4 | .vscode/** 5 | 6 | # Dir 7 | node_modules 8 | 9 | # OS generated files # 10 | ###################### 11 | # General 12 | .DS_Store 13 | .DS_Store? 14 | .AppleDouble 15 | .LSOverride 16 | ehthumbs.db 17 | Thumbs.db 18 | 19 | # Thumbnails 20 | ._* 21 | 22 | # Files that might appear in the root of a volume 23 | .DocumentRevisions-V100 24 | .fseventsd 25 | .Spotlight-V100 26 | .TemporaryItems 27 | .Trashes 28 | .VolumeIcon.icns 29 | 30 | # Packages # 31 | ############ 32 | *.7z 33 | *.dmg 34 | *.gz 35 | *.iso 36 | *.jar 37 | *.rar 38 | *.tar 39 | *.zip -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | *.php 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ## [1.1.3](https://github.com/h4kst3r/php-awesome-snippets/compare/v1.1.2...v1.1.3) (2019-04-19) 6 | 7 | 8 | ### Style 9 | 10 | * **control.json:** Update control structure snippets' prefixes with 'end' form by removing the `d` for consistency ([ca87d47](https://github.com/h4kst3r/php-awesome-snippets/commit/ca87d47)) 11 | 12 | This is not a Breaking change as you just don't need to type the last letter. 13 | 14 | 15 | ### Build 16 | 17 | * Update package.json keywords 18 | 19 | 20 | 21 | ## [1.1.2](https://github.com/h4kst3r/php-awesome-snippets/compare/v1.1.1...v1.1.2) (2019-04-19) 22 | 23 | 24 | ### Bug Fixes 25 | 26 | * **README.md:** Fix demo GIF not found on marketplace extension details ([b8a64b0](https://github.com/h4kst3r/php-awesome-snippets/commit/b8a64b0)) 27 | 28 | 29 | 30 | ## [1.1.1](https://github.com/h4kst3r/php-awesome-snippets/compare/v1.1.0...v1.1.1) (2019-04-19) 31 | 32 | * Update SemVer badge 33 | * Update package.json to fix some grafic problem on the VScode marketplace 34 | 35 | 36 | 37 | # [1.1.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v1.0.0...v1.1.0) (2019-04-18) 38 | 39 | 40 | ### Features 41 | 42 | * **package.json:** Add snippets available in Plain Text context and PHP tags available in HTML one ([3b21da7](https://github.com/h4kst3r/php-awesome-snippets/commit/3b21da7)) 43 | * **statement.json:** Add __DIR__ placeholder in 'include' and 'require' snippets to use absolute path ([b1a381b](https://github.com/h4kst3r/php-awesome-snippets/commit/b1a381b)) 44 | 45 | 46 | 47 | # [1.0.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.9.0...v1.0.0) (2019-04-18) 48 | 49 | 50 | ### Features 51 | 52 | * **globalvar.json:** Update globalvar snippets with new prefix ([1a20ee2](https://github.com/h4kst3r/php-awesome-snippets/commit/1a20ee2)) 53 | 54 | 55 | ### BREAKING CHANGES 56 | 57 | * **globalvar.json:** Previous prefixes are no longer working. 58 | 59 | 60 | 61 | # [0.9.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.8.0...v0.9.0) (2019-04-18) 62 | 63 | 64 | ### Features 65 | 66 | * **array.json:** Add new array snippets and addon snippets ([3b0e092](https://github.com/h4kst3r/php-awesome-snippets/commit/3b0e092)) 67 | 68 | 69 | 70 | # [0.8.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.7.0...v0.8.0) (2019-04-18) 71 | 72 | 73 | ### Bug Fixes 74 | 75 | * **error.json:** Modify escaping for '$' sign avoiding VScode warnings ([e88b5ba](https://github.com/h4kst3r/php-awesome-snippets/commit/e88b5ba)) 76 | 77 | 78 | ### Features 79 | 80 | * **error.json:** Upgrade error snippets placeholders, new snippets and addon snippets ([30befd9](https://github.com/h4kst3r/php-awesome-snippets/commit/30befd9)) 81 | 82 | 83 | 84 | # [0.7.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.6.0...v0.7.0) (2019-04-18) 85 | 86 | 87 | ### Features 88 | 89 | * **method.json:** Add method arguments' type hint placeholders for PHP7 methods ([695b1e7](https://github.com/h4kst3r/php-awesome-snippets/commit/695b1e7)) 90 | * **method(.php5).json:** Add missing constructors, final and abstract method snippets - PHP7 and PHP5 ([00ea250](https://github.com/h4kst3r/php-awesome-snippets/commit/00ea250)) 91 | 92 | 93 | 94 | # [0.6.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.5.0...v0.6.0) (2019-04-17) 95 | 96 | 97 | ### Features 98 | 99 | * **class.json:** Add class, interface and trait snippets ([ebc2166](https://github.com/h4kst3r/php-awesome-snippets/commit/ebc2166)) 100 | 101 | 102 | 103 | # [0.5.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.4.0...v0.5.0) (2019-04-17) 104 | 105 | 106 | ### Bug Fixes 107 | 108 | * **loop.json:** Modify escaping for '$' sign avoiding VScode warnings ([a61164a](https://github.com/h4kst3r/php-awesome-snippets/commit/a61164a)) 109 | 110 | 111 | ### Features 112 | 113 | * **loop.json:** Upgrade placeholders mapping for while loops ([fef8af7](https://github.com/h4kst3r/php-awesome-snippets/commit/fef8af7)) 114 | 115 | 116 | 117 | # [0.4.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.3.0...v0.4.0) (2019-04-17) 118 | 119 | 120 | ### Bug Fixes 121 | 122 | * **control.json:** Fix duplicate placeholders in 'ifelifend' snippet ([9d1b77f](https://github.com/h4kst3r/php-awesome-snippets/commit/9d1b77f)) 123 | * **control.json:** Modify escaping for '$' sign avoiding VScode warnings ([e683c54](https://github.com/h4kst3r/php-awesome-snippets/commit/e683c54)) 124 | 125 | 126 | ### Features 127 | 128 | * **control.json:** Upgrade switch snippet's placeholders mapping and add new addon snippet ([7bea4b6](https://github.com/h4kst3r/php-awesome-snippets/commit/7bea4b6)) 129 | 130 | 131 | 132 | # [0.3.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.2.0...v0.3.0) (2019-04-16) 133 | 134 | 135 | ### Bug Fixes 136 | 137 | * **function.json:** Modify escaping for '$' sign avoiding VScode warnings ([2909561](https://github.com/h4kst3r/php-awesome-snippets/commit/2909561)) 138 | 139 | 140 | ### Features 141 | 142 | * **function.json:** Add anonymous function snippet - PHP7 and PHP5 ([7347054](https://github.com/h4kst3r/php-awesome-snippets/commit/7347054)) 143 | * **function.json:** Add anonymous function with use snippets - PHP7 and PHP5 ([6aa4b68](https://github.com/h4kst3r/php-awesome-snippets/commit/6aa4b68)) 144 | 145 | 146 | 147 | # [0.2.0](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.1.2...v0.2.0) (2019-04-15) 148 | 149 | 150 | ### Features 151 | 152 | * **statement.json:** Add print_r snippet ([d3caaa0](https://github.com/h4kst3r/php-awesome-snippets/commit/d3caaa0)) 153 | * **statement.json:** Add var_export snippet ([6e56781](https://github.com/h4kst3r/php-awesome-snippets/commit/6e56781)) 154 | * **statement.json:** Add var_dump snippet ([45d3211](https://github.com/h4kst3r/php-awesome-snippets/commit/45d3211)) 155 | 156 | 157 | 158 | ## [0.1.2](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.1.1...v0.1.2) (2019-04-15) 159 | 160 | 161 | ### Bug Fixes 162 | 163 | * **tag.json:** Change escaping for '$' sign avoiding VScode warning ([6d4e9a0](https://github.com/h4kst3r/php-awesome-snippets/commit/6d4e9a0)) 164 | 165 | 166 | 167 | ## [0.1.1](https://github.com/h4kst3r/php-awesome-snippets/compare/v0.1.0...v0.1.1) (2019-04-15) 168 | * Refactor code by dividing the main php.json in thematic snippets files to improve framework : 169 | - Tag snippets (open, close, short echo tag...) 170 | - Statement snippets (echo, define, include...) 171 | - Function snippets *PHP7 and PHP5 style* 172 | - Global vars snippets ($_POST, $_GET, $_SESSION...) 173 | - Conditional snippets (if, if-else, if-endif...) 174 | - Loop snippets (foreach, while, for...) 175 | - Method snippets (public, private, static...) *PHP7 and PHP5 style* 176 | - Error snippets (throw, try-catch) 177 | 178 | *Features are incomplete and still in alpha stage with bugs and warnings* 179 | 180 | 181 | # 0.1.0 (2019-04-15) 182 | * Initial release with all features in alpha stages 183 | * Some bugs : placeholders in superglobal snippets, duplicate placeholders 184 | * Some conflicts with built-in snippets -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 JH Ster 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Awesome Snippets - VScode extension 2 | 3 | [![VScode](https://img.shields.io/badge/Extension-VScode-blueviolet.svg)](https://marketplace.visualstudio.com/items?itemName=hakcorp.php-awesome-snippets) 4 | ![Snippets](https://img.shields.io/badge/Type-Snippets-yellow.svg) 5 | ![PHP7](https://img.shields.io/badge/PHP-%5E7.0-blue.svg) 6 | ![PHP5](https://img.shields.io/badge/PHP-%5E5.4-blue.svg) 7 | [![SemVer](https://img.shields.io/badge/SemVer-1.1.3-%23B71C1C.svg)](https://github.com/h4kst3r/php-awesome-snippets/blob/master/CHANGELOG.md) 8 | [![MIT](https://img.shields.io/badge/License-MIT-%2300C853.svg)](https://github.com/h4kst3r/php-awesome-snippets/blob/master/LICENSE) 9 | 10 | [![PSR-1](https://img.shields.io/badge/Standard-PSR--1-%2326A69A.svg)](https://www.php-fig.org/psr/psr-1/) 11 | [![PSR-2](https://img.shields.io/badge/Standard-PSR--2-%2326A69A.svg)](https://www.php-fig.org/psr/psr-2/) 12 | [![PSR-12](https://img.shields.io/badge/Standard-PSR--12-%2326A69A.svg)](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md) 13 | 14 | **This [VScode extension](https://marketplace.visualstudio.com/items?itemName=hakcorp.php-awesome-snippets) provide a fullset of snippets for PHP devs. It's pretty simple !** 15 | 16 | You can use it to avoid wasting time typing Class blocks, function signatures or other common PHP statements. 17 | 18 | ![Demo PHP Awesome Snippets](img/snipdemo.gif) 19 | 20 | The code generated is **as compliant as possible** with [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/) and [PSR-12](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md) (*Review* stage) coding standards provided by [PHP-FIG](https://www.php-fig.org/). 21 | 22 | Snippets are PHP7 oriented (type hinting and return type) but PHP5 compatibility is also provided (see [Functions](#function-snip) and [Methods](#method-snip) sections). 23 | 24 | This work is inspired by PHPstorm (*PHP Live Templates*) and other works available on VScode marketplace like [PHP Snippets VS Code](https://github.com/heberalmeida/php-snippets) or [PHP Snippet Pack](https://github.com/jm-mwi/vscode-php-snippets/). 25 | 26 | ## Usage 27 | Type a snippet (or part of it), press `Enter` or `Tab` (if `editor.tabCompletion` set to `true` in your settings) and the snippet will expand just right there. 28 | 29 | > ***Tip :*** Snippets provided in this extension support `tab` to next/previous placeholder. 30 | 31 | These snippets are meant to work in **PHP context** (VScode file). However there are also available in **Plain Text context** for convenience and PHP tags are available in **HTML** one. 32 | 33 | ## Features 34 | 35 | These snippets try to be **as intuitive as possible** and to avoid conflicts with previous or built-in snippets. 36 | 37 | Placeholders are quite *'easy to use'* though some need optimizations. 38 | > ***Tip :*** If you want to use snippets and completion in placeholders 39 | > look at the [Extension settings](#ext-settings) section. 40 | 41 | ---- 42 | ### PHP tags 43 | 44 | | Snippet | Output | 45 | | --- | --- | 46 | | php | `` | 47 | | po | `` | 49 | | peco | `` | 50 | 51 | ---- 52 | ### Superglobals 53 | 54 | | Snippet | Output | 55 | | --- | --- | 56 | | gget | `$_GET["..."]` | 57 | | gpost | `$_POST["..."]` | 58 | | gss | `$_SESSION["..."]` | 59 | | gfile | `$_FILES['...']['...']` | 60 | | gcook | `$_COOKIE["..."]` | 61 | | gser | `$_SERVER["..."]` | 62 | | greq | `$_REQUEST["..."]` | 63 | | genv | `$_ENV["..."]` | 64 | | gglob | `$GLOBALS["..."]` | 65 | 66 | ---- 67 | ### Arrays 68 | 69 | | Snippet | Output | 70 | | --- | --- | 71 | | arr | `[value, value, ...];` | 72 | | ark | `['key' => value, 'key' => value,...]` | 73 | | kv | `'key' => value,` **[1]** | 74 | | va | `value, ` **[1]** | 75 | 76 | * **[1]** Addon snippet : use with `arr` or `ark` snippet to add `value` or `key => value` if needed. 77 | 78 | ---- 79 | ### Statements and common functions calls 80 | 81 | | Snippet | Output | 82 | | --- | --- | 83 | | eco | `echo "...";` | 84 | | inc | `include __DIR__.'...';` | 85 | | inco | `include_once __DIR__.'...';` | 86 | | rqr | `require __DIR__.'...';` | 87 | | rqro | `require_once __DIR__.'...';` | 88 | | df | `define("...", "...");` | 89 | | pr | `print_r(...);` | 90 | | vd | `var_dump(...);` | 91 | | vx | `var_export(...);` | 92 | 93 | ---- 94 | ### Functions 95 | 96 | | Snippet | Output | 97 | | --- | --- | 98 | | fn | `function func_name(Type $args): void {...}` | 99 | | fna | `function (Type $args): void {...}` | 100 | | fnu | `function (Type $args) use ($vars): void {...}` | 101 | 102 | ***Tip :*** You can call `functions` snippets above without type hinting and return type (**PHP5 compatibility**) by using **`-`** as prefix. 103 | > * `-fna` for `function ($args) {...}` *(anonymous function block)* 104 | 105 | ---- 106 | ### Control structures 107 | 108 | | Snippet | Output | 109 | | --- | --- | 110 | | ifb | `if (condition) {...}` | 111 | | ifel | `if (condition) {...} else {...}` | 112 | | ifelif | `if (condition) {...} elseif (condition) {...} else {...}` | 113 | | sw | `switch ($variable) { case 'label': ... break; ... default: ... break; }` | 114 | | cs | `case 'label': ... break;` **[1]** | 115 | | tern | `condition ? if_true : if_false;` | 116 | 117 | * **[1]** Addon snippet : use with `sw` snippet to add `case` if needed. 118 | 119 | ***Tip :*** Other `if ... else` form is also available if needed: 120 | 121 | > | Snippet | Output | 122 | > | --- | --- | 123 | > | ifen | `if (condition): ... endif;` | 124 | > | ifelen | `if (condition): ... else: ... endif;` | 125 | > | ifelifen | `if (condition): ... elseif (condition): ... else: ... endif;` | 126 | 127 | ---- 128 | ### Loops structures 129 | 130 | | Snippet | Output | 131 | | --- | --- | 132 | | fore | `foreach ($iterable as $item) {...}` | 133 | | forek | `foreach ($iterable as $key => $item) {...}` | 134 | | forl | `for ($i = 0; $i < $limit; $i++) {...}` | 135 | | wl | `while ($variable <= $limit) {...}` | 136 | | dowl | `do {...} while ($variable <= $limit);` | 137 | 138 | ***Tip :*** Other loops form is also available if needed: 139 | 140 | > | Snippet | Output | 141 | > | --- | --- | 142 | > | foren | `foreach ($iterable as $item): {...} endforeach;` | 143 | > | forenk | `foreach ($iterable as $key => $item): {...} endforeach;` | 144 | > | forlen | `for ($i = 0; $i < $limit; $i++): {...} endfor;` | 145 | > | wlen | `while ($variable <= $limit): {...} endwhile;` | 146 | 147 | ---- 148 | ### Classes, interfaces and traits 149 | 150 | | Snippet | Output | 151 | | --- | --- | 152 | | cl | `class ClassName {...}` | 153 | | clx | `class ClassName extends MotherClass {...}` | 154 | | cli | `class ClassName implements Interfaces {...}` | 155 | | clxi | `class ClassName extends MotherClass implements Interfaces {...}` | 156 | | in | `interface InterfaceName {...}` | 157 | | inx | `interface InterfaceName extends Interfaces {...}` | 158 | | trt | `trait TraitName {...}` | 159 | 160 | ***Tip :*** You can call `Class` snippets above with `abstract` or `final` form by using **`a`** or **`f`** as prefix. 161 | > * `acl` for `abstract class ClassName {...}` 162 | > * `fcli` for `final class ClassName implements Interfaces {...}` 163 | 164 | ---- 165 | ### Methods 166 | 167 | **Constructor** 168 | 169 | | Snippet | Output | 170 | | --- | --- | 171 | | pubc | `public function __construct(Type $args) {...}` | 172 | | proc | `protected function __construct(Type $args) {...}` | 173 | | pric | `private function __construct(Type $args) {...}` | 174 | 175 | **Method** 176 | 177 | | Snippet | Output | 178 | | --- | --- | 179 | || **Public methods** | 180 | | pubf | `public function methodName(Type $args): void {...}` | 181 | | pubsf | `public static function methodName(Type $args): void {...}` | 182 | || **Protected methods** | 183 | | prof | `protected function methodName(Type $args): void {...}` | 184 | | prosf | `protected static function methodName(Type $args): void {...}` | 185 | || **Private methods** | 186 | | prif | `private function methodName(Type $args): void {...}` | 187 | | prisf | `private static function methodName(Type $args): void {...}` | 188 | 189 | ***Tip :*** You can call `methods` snippets above with `abstract` or `final` form by using **`a`** or **`f`** as prefix. 190 | > * `aprof` for `abstract protected function methodName(Type $args): void {...}` 191 | > * `fpubsf` for `final public static function methodName(Type $args): void {...}` 192 | 193 | ***Tip :*** You can call `methods` snippets above without type hinting 194 | and return type (**PHP5 compatibility**) by using **`-`** as prefix. 195 | > * `-apubf` for `abstract public function methodName(parameters) {...}` 196 | 197 | ---- 198 | ### Errors 199 | 200 | | Snippet | Output | 201 | | --- | --- | 202 | | tryc | `try {...} catch (\Throwable $e) {...}` | 203 | | tryf | `try {...} catch (\Throwable $e) {...} finally {...}` | 204 | | cat | `catch (\Throwable $e) {...}` **[1]** | 205 | | fy | `finally {...}` **[2]** | 206 | | thr | `throw new SomeException("Error statement");` | 207 | 208 | * **[1]** Addon snippet : use with `tryc` or `tryf` snippet to add `catch` if needed. 209 | * **[2]** Addon snippet : use with `tryc` snippet to add `finally` if needed. 210 | 211 | ## Requirements 212 | 213 | All you need is VScode installed on your machine. 214 | 215 | * Install the extension from `Extensions` menu. 216 | 217 | * You can also press `F1` then type: 218 | 219 | `ext install hakcorp.php-awesome-snippets` 220 | 221 | ## Extension Settings 222 | 223 | The VScode default behavior deactivate IntelliSense suggestions when you're filling placeholders. However if you want to use completion and snippets inside placeholders : 224 | 225 | * Open your settings.json file ( **{ }** icon at the top right corner of the settings tab). 226 | 227 | * Add this line anywhere you want: `"editor.suggest.snippetsPreventQuickSuggestions": false` 228 | 229 | Now you can call snippets and any suggestion in placeholders without typing `Ctrl+space`. 230 | 231 | ## Known Issues 232 | 233 | If suggestions menu does not open, press `Ctrl+space` to open it manually. 234 | 235 | Sometimes IntelliSense freezes loading or simply doesn't select the called snippet. Backspace and try again, it should work. 236 | 237 | ## Release Notes 238 | 239 | All notable changes to this project will be documented in [CHANGELOG.md](https://github.com/h4kst3r/php-awesome-snippets/blob/master/CHANGELOG.md). 240 | 241 | ## License 242 | 243 | [MIT](https://github.com/h4kst3r/php-awesome-snippets/blob/master/LICENSE) License -------------------------------------------------------------------------------- /img/php-awesome-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/h4kst3r/php-awesome-snippets/df0fa89381b2c1b3af5fe128dafabf2240e1d266/img/php-awesome-icon.png -------------------------------------------------------------------------------- /img/snipdemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/h4kst3r/php-awesome-snippets/df0fa89381b2c1b3af5fe128dafabf2240e1d266/img/snipdemo.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "php-awesome-snippets", 3 | "displayName": "PHP Awesome Snippets", 4 | "version": "1.1.3", 5 | "publisher": "hakcorp", 6 | "description": "A fullset of snippets for PHP devs to boost coding productivity.", 7 | "author": { 8 | "name": "JH Ster" 9 | }, 10 | "categories": [ 11 | "Snippets", 12 | "Programming Languages" 13 | ], 14 | "keywords": [ 15 | "snippets", 16 | "productivity", 17 | "coding", 18 | "php7", 19 | "psr" 20 | ], 21 | "icon": "img/php-awesome-icon.png", 22 | "galleryBanner": { 23 | "color": "#eceff1", 24 | "theme": "light" 25 | }, 26 | "engines": { 27 | "vscode": "^1.0.0" 28 | }, 29 | "license": "MIT", 30 | "bugs": { 31 | "url": "https://github.com/h4kst3r/php-awesome-snippets/issues" 32 | }, 33 | "repository": { 34 | "type": "git", 35 | "url": "https://github.com/h4kst3r/php-awesome-snippets" 36 | }, 37 | "homepage": "https://github.com/h4kst3r/php-awesome-snippets", 38 | "contributes": { 39 | "snippets": [ 40 | { 41 | "language": "php", 42 | "path": "./snippets/array.json" 43 | }, 44 | { 45 | "language": "php", 46 | "path": "./snippets/class.json" 47 | }, 48 | { 49 | "language": "php", 50 | "path": "./snippets/control.json" 51 | }, 52 | { 53 | "language": "php", 54 | "path": "./snippets/error.json" 55 | }, 56 | { 57 | "language": "php", 58 | "path": "./snippets/function.json" 59 | }, 60 | { 61 | "language": "php", 62 | "path": "./snippets/function.php5.json" 63 | }, 64 | { 65 | "language": "php", 66 | "path": "./snippets/globalvar.json" 67 | }, 68 | { 69 | "language": "php", 70 | "path": "./snippets/loop.json" 71 | }, 72 | { 73 | "language": "php", 74 | "path": "./snippets/method.json" 75 | }, 76 | { 77 | "language": "php", 78 | "path": "./snippets/method.php5.json" 79 | }, 80 | { 81 | "language": "php", 82 | "path": "./snippets/statement.json" 83 | }, 84 | { 85 | "language": "php", 86 | "path": "./snippets/tag.json" 87 | }, 88 | { 89 | "language": "html", 90 | "path": "./snippets/tag.json" 91 | }, 92 | { 93 | "language": "plaintext", 94 | "path": "./snippets/array.json" 95 | }, 96 | { 97 | "language": "plaintext", 98 | "path": "./snippets/class.json" 99 | }, 100 | { 101 | "language": "plaintext", 102 | "path": "./snippets/control.json" 103 | }, 104 | { 105 | "language": "plaintext", 106 | "path": "./snippets/error.json" 107 | }, 108 | { 109 | "language": "plaintext", 110 | "path": "./snippets/function.json" 111 | }, 112 | { 113 | "language": "plaintext", 114 | "path": "./snippets/function.php5.json" 115 | }, 116 | { 117 | "language": "plaintext", 118 | "path": "./snippets/globalvar.json" 119 | }, 120 | { 121 | "language": "plaintext", 122 | "path": "./snippets/loop.json" 123 | }, 124 | { 125 | "language": "plaintext", 126 | "path": "./snippets/method.json" 127 | }, 128 | { 129 | "language": "plaintext", 130 | "path": "./snippets/method.php5.json" 131 | }, 132 | { 133 | "language": "plaintext", 134 | "path": "./snippets/statement.json" 135 | }, 136 | { 137 | "language": "plaintext", 138 | "path": "./snippets/tag.json" 139 | } 140 | ] 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /snippets/array.json: -------------------------------------------------------------------------------- 1 | { 2 | "Array": { 3 | "prefix": "arr", 4 | "body": [ 5 | "[${1:value}, ${2:value}, $3];" 6 | ], 7 | "description": "Array [] block" 8 | }, 9 | "Array key ... value": { 10 | "prefix": "ark", 11 | "body": [ 12 | "[", 13 | "\t'${1:key}' => ${2:value},", 14 | "\t'${3:key}' => ${4:value},$5", 15 | "]" 16 | ], 17 | "description": "Array [] key => value block" 18 | }, 19 | "Key ... value": { 20 | "prefix": "kv", 21 | "body": [ 22 | "'${1:key}' => ${2:value}," 23 | ], 24 | "description": "key => value statement" 25 | }, 26 | "Array ... value": { 27 | "prefix": "va", 28 | "body": [ 29 | "${1:value}, " 30 | ], 31 | "description": "Array value statement" 32 | } 33 | } -------------------------------------------------------------------------------- /snippets/class.json: -------------------------------------------------------------------------------- 1 | { 2 | "Class": { 3 | "prefix": "cl", 4 | "body": [ 5 | "class ${1:ClassName}", 6 | "{", 7 | "\t${0:# code...}", 8 | "}" 9 | ], 10 | "description": "PHP Class block" 11 | }, 12 | "Class extends": { 13 | "prefix": "clx", 14 | "body": [ 15 | "class ${1:ClassName} extends ${2:MotherClass}", 16 | "{", 17 | "\t${0:# code...}", 18 | "}" 19 | ], 20 | "description": "PHP Class extends block" 21 | }, 22 | "Class implements": { 23 | "prefix": "cli", 24 | "body": [ 25 | "class ${1:ClassName} implements ${2:Interfaces}", 26 | "{", 27 | "\t${0:# code...}", 28 | "}" 29 | ], 30 | "description": "PHP Class implements block" 31 | }, 32 | "Class extends implements": { 33 | "prefix": "clxi", 34 | "body": [ 35 | "class ${1:ClassName} extends ${2:MotherClass} implements ${3:Interfaces}", 36 | "{", 37 | "\t${0:# code...}", 38 | "}" 39 | ], 40 | "description": "PHP Class extends and implements block" 41 | }, 42 | "Abstract class": { 43 | "prefix": "acl", 44 | "body": [ 45 | "abstract class ${1:ClassName}", 46 | "{", 47 | "\t${0:# code...}", 48 | "}" 49 | ], 50 | "description": "PHP abstract Class block" 51 | }, 52 | "Abstract class extends": { 53 | "prefix": "aclx", 54 | "body": [ 55 | "abstract class ${1:ClassName} extends ${2:MotherClass}", 56 | "{", 57 | "\t${0:# code...}", 58 | "}" 59 | ], 60 | "description": "PHP abstract Class extends block" 61 | }, 62 | "Abstract class implements": { 63 | "prefix": "acli", 64 | "body": [ 65 | "abstract class ${1:ClassName} implements ${2:Interfaces}", 66 | "{", 67 | "\t${0:# code...}", 68 | "}" 69 | ], 70 | "description": "PHP abstract Class implements block" 71 | }, 72 | "Abstract class extends implements": { 73 | "prefix": "aclxi", 74 | "body": [ 75 | "abstract class ${1:ClassName} extends ${2:MotherClass} implements ${3:Interfaces}", 76 | "{", 77 | "\t${0:# code...}", 78 | "}" 79 | ], 80 | "description": "PHP abstract Class extends and implements block" 81 | }, 82 | "Final class": { 83 | "prefix": "fcl", 84 | "body": [ 85 | "final class ${1:ClassName}", 86 | "{", 87 | "\t${0:# code...}", 88 | "}" 89 | ], 90 | "description": "PHP final Class block" 91 | }, 92 | "Final class extends": { 93 | "prefix": "fclx", 94 | "body": [ 95 | "final class ${1:ClassName} extends ${2:MotherClass}", 96 | "{", 97 | "\t${0:# code...}", 98 | "}" 99 | ], 100 | "description": "PHP final Class extends block" 101 | }, 102 | "Final class implements": { 103 | "prefix": "fcli", 104 | "body": [ 105 | "final class ${1:ClassName} implements ${2:Interfaces}", 106 | "{", 107 | "\t${0:# code...}", 108 | "}" 109 | ], 110 | "description": "PHP final Class implements block" 111 | }, 112 | "Final class extends implements": { 113 | "prefix": "fclxi", 114 | "body": [ 115 | "final class ${1:ClassName} extends ${2:MotherClass} implements ${3:Interfaces}", 116 | "{", 117 | "\t${0:# code...}", 118 | "}" 119 | ], 120 | "description": "PHP final Class extends and implements block" 121 | }, 122 | "Interface": { 123 | "prefix": "in", 124 | "body": [ 125 | "interface ${1:InterfaceName}", 126 | "{", 127 | "\t${0:# code...}", 128 | "}" 129 | ], 130 | "description": "PHP Interface block" 131 | }, 132 | "Interface extends": { 133 | "prefix": "inx", 134 | "body": [ 135 | "interface ${1:InterfaceName} extends ${2:Interfaces}", 136 | "{", 137 | "\t${0:# code...}", 138 | "}" 139 | ], 140 | "description": "PHP Interface extends block" 141 | }, 142 | "Trait": { 143 | "prefix": "trt", 144 | "body": [ 145 | "trait ${1:TraitName}", 146 | "{", 147 | "\t${0:# code...}", 148 | "}" 149 | ], 150 | "description": "PHP Trait block" 151 | } 152 | } -------------------------------------------------------------------------------- /snippets/control.json: -------------------------------------------------------------------------------- 1 | { 2 | "If ... endif": { 3 | "prefix": "ifen", 4 | "body": [ 5 | "if (${1:condition}):", 6 | "\t${0:# code...}", 7 | "endif;" 8 | ], 9 | "description": "If endif block" 10 | }, 11 | "If ... else ... endif": { 12 | "prefix": "ifelen", 13 | "body": [ 14 | "if (${1:condition}):", 15 | "\t${2:# code...}", 16 | "else:", 17 | "\t${0:# code...}", 18 | "endif;" 19 | ], 20 | "description": "If else endif block" 21 | }, 22 | "If ... elseif ... else ... endif": { 23 | "prefix": "ifelifen", 24 | "body": [ 25 | "if (${1:condition}):", 26 | "\t${2:# code...}", 27 | "elseif (${3:condition}):", 28 | "\t${4:# code...}", 29 | "else:", 30 | "\t${0:# code...}", 31 | "endif;" 32 | ], 33 | "description": "If elseif else endif block" 34 | }, 35 | "If block": { 36 | "prefix": "ifb", 37 | "body": [ 38 | "if (${1:condition}) {", 39 | "\t${0:# code...}", 40 | "}" 41 | ], 42 | "description": "If block" 43 | }, 44 | "If ... else": { 45 | "prefix": "ifel", 46 | "body": [ 47 | "if (${1:condition}) {", 48 | "\t${2:# code...}", 49 | "} else {", 50 | "\t${0:# code...}", 51 | "}" 52 | ], 53 | "description": "If else block" 54 | }, 55 | "If ... elseif ... else": { 56 | "prefix": "ifelif", 57 | "body": [ 58 | "if (${1:condition}) {", 59 | "\t${2:# code...}", 60 | "} elseif (${3:condition}) {", 61 | "\t${4:# code...}", 62 | "} else {", 63 | "\t${0:# code...}", 64 | "}" 65 | ], 66 | "description": "If elseif else block" 67 | }, 68 | "Switch block": { 69 | "prefix": "sw", 70 | "body": [ 71 | "switch (\\$${1:variable}) {", 72 | "\tcase '${2:label}':", 73 | "\t\t${3:# code...}", 74 | "\t\tbreak;", 75 | "\tcase '${4:label}':", 76 | "\t\t${5:# code...}", 77 | "\t\tbreak;$6", 78 | "\tdefault:", 79 | "\t\t${0:# code...}", 80 | "\t\tbreak;", 81 | "}" 82 | ], 83 | "description": "Switch block" 84 | }, 85 | "Case statement": { 86 | "prefix": "cs", 87 | "body": [ 88 | "case '${1:label}':", 89 | "\t${2:# code...}", 90 | "\tbreak;" 91 | ], 92 | "description": "Case addon block" 93 | }, 94 | "Ternary operator": { 95 | "prefix": "tern", 96 | "body": [ 97 | "${1:condition} ? ${2:if_true} : ${3:if_false};" 98 | ], 99 | "description": "Ternary statement" 100 | } 101 | } -------------------------------------------------------------------------------- /snippets/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "Try ... catch": { 3 | "prefix": "tryc", 4 | "body": [ 5 | "try {", 6 | "\t${1:# code...}", 7 | "} catch (${2:\\Throwable} \\$${3:e}) {", 8 | "\t${4:# code...}", 9 | "}" 10 | ], 11 | "description": "Try catch block" 12 | }, 13 | "Try ... catch ... finally": { 14 | "prefix": "tryf", 15 | "body": [ 16 | "try {", 17 | "\t${1:# code...}", 18 | "} catch (${2:\\Throwable} \\$${3:e}) {", 19 | "\t${4:# code...}", 20 | "}$5 finally {", 21 | "\t${0:# code...}", 22 | "}" 23 | ], 24 | "description": "Try catch finally block" 25 | }, 26 | "Catch": { 27 | "prefix": "cat", 28 | "body": [ 29 | "catch (${1:\\Throwable} \\$${2:e}) {", 30 | "\t${3:# code...}", 31 | "}" 32 | ], 33 | "description": "Catch block" 34 | }, 35 | "Finally": { 36 | "prefix": "fy", 37 | "body": [ 38 | "finally {", 39 | "\t${0:# code...}", 40 | "}" 41 | ], 42 | "description": "Finally block" 43 | }, 44 | "Throw new Exception": { 45 | "prefix": "thr", 46 | "body": [ 47 | "throw new ${1:Some}Exception(\"${2:Error statement}\");" 48 | ], 49 | "description": "Throw new exception statement" 50 | } 51 | } -------------------------------------------------------------------------------- /snippets/function.json: -------------------------------------------------------------------------------- 1 | { 2 | "Function": { 3 | "prefix": "fn", 4 | "body": [ 5 | "function ${1:func_name}(${2:Type} \\$${3:args}): ${4:void} {", 6 | "\t${0:# code...}", 7 | "}" 8 | ], 9 | "description": "Function block" 10 | }, 11 | "Anonymous function": { 12 | "prefix": "fna", 13 | "body": [ 14 | "function (${1:Type} \\$${2:args}): ${3:void} {", 15 | "\t${0:# code...}", 16 | "}" 17 | ], 18 | "description": "Anonymous function block" 19 | }, 20 | "Anonymous function ... use": { 21 | "prefix": "fnu", 22 | "body": [ 23 | "function (${1:Type} \\$${2:args}) use (\\$${3:vars}): ${4:void} {", 24 | "\t${0:# code...}", 25 | "}" 26 | ], 27 | "description": "Anonymous function with use block" 28 | } 29 | } -------------------------------------------------------------------------------- /snippets/function.php5.json: -------------------------------------------------------------------------------- 1 | { 2 | "Function PHP5": { 3 | "prefix": "-fn", 4 | "body": [ 5 | "function ${1:func_name}(\\$${2:args}) {", 6 | "\t${0:# code...}", 7 | "}" 8 | ], 9 | "description": "Function block PHP5" 10 | }, 11 | "Anonymous function PHP5": { 12 | "prefix": "-fna", 13 | "body": [ 14 | "function (\\$${1:args}) {", 15 | "\t${0:# code...}", 16 | "}" 17 | ], 18 | "description": "Anonymous function block PHP5" 19 | }, 20 | "Anonymous function ... use PHP5": { 21 | "prefix": "-fnu", 22 | "body": [ 23 | "function (\\$${1:args}) use (\\$${2:vars}) {", 24 | "\t${0:# code...}", 25 | "}" 26 | ], 27 | "description": "Anonymous function with use block PHP5" 28 | } 29 | } -------------------------------------------------------------------------------- /snippets/globalvar.json: -------------------------------------------------------------------------------- 1 | { 2 | "GLOBAL array": { 3 | "prefix": "gglob", 4 | "body": [ 5 | "\\$GLOBALS[\"${1:key}\"]" 6 | ], 7 | "description": "$GLOBALS array" 8 | }, 9 | "SERVER array": { 10 | "prefix": "gser", 11 | "body": [ 12 | "\\$_SERVER[\"${1:key}\"]" 13 | ], 14 | "description": "$_SERVER array" 15 | }, 16 | "REQUEST array": { 17 | "prefix": "greq", 18 | "body": [ 19 | "\\$_REQUEST[\"${1:key}\"]" 20 | ], 21 | "description": "$_REQUEST array" 22 | }, 23 | "POST array": { 24 | "prefix": "gpost", 25 | "body": [ 26 | "\\$_POST[\"${1:key}\"]" 27 | ], 28 | "description": "$_POST array" 29 | }, 30 | "GET array": { 31 | "prefix": "gget", 32 | "body": [ 33 | "\\$_GET[\"${1:key}\"]" 34 | ], 35 | "description": "$_GET array" 36 | }, 37 | "FILES array": { 38 | "prefix": "gfile", 39 | "body": [ 40 | "\\$_FILES['${1:userfile}']['${2:key}']" 41 | ], 42 | "description": "$_FILES array" 43 | }, 44 | "ENV array": { 45 | "prefix": "genv", 46 | "body": [ 47 | "\\$_ENV[\"${1:key}\"]" 48 | ], 49 | "description": "$_ENV array" 50 | }, 51 | "COOKIE array": { 52 | "prefix": "gcook", 53 | "body": [ 54 | "\\$_COOKIE[\"${1:key}\"]" 55 | ], 56 | "description": "$_COOKIE array" 57 | }, 58 | "SESSION array": { 59 | "prefix": "gss", 60 | "body": [ 61 | "\\$_SESSION[\"${1:key}\"]" 62 | ], 63 | "description": "$_SESSION array" 64 | } 65 | } -------------------------------------------------------------------------------- /snippets/loop.json: -------------------------------------------------------------------------------- 1 | { 2 | "Foreach loop": { 3 | "prefix": "fore", 4 | "body": [ 5 | "foreach (\\$${1:iterable} as \\$${2:item}) {", 6 | "\t${0:# code...}", 7 | "}" 8 | ], 9 | "description": "Foreach as $item block" 10 | }, 11 | "Foreach ... key ... item": { 12 | "prefix": "forek", 13 | "body": [ 14 | "foreach (\\$${1:iterable} as \\$${2:key} => \\$${3:item}) {", 15 | "\t${0:# code...}", 16 | "}" 17 | ], 18 | "description": "Foreach as $key => $item block" 19 | }, 20 | "Foreach ... end": { 21 | "prefix": "foren", 22 | "body": [ 23 | "foreach (\\$${1:iterable} as \\$${2:item}):", 24 | "\t${0:# code...}", 25 | "endforeach;" 26 | ], 27 | "description": "Foreach end as $item block" 28 | }, 29 | "Foreach ... key ... item ... end": { 30 | "prefix": "forenk", 31 | "body": [ 32 | "foreach (\\$${1:iterable} as \\$${2:key} => \\$${3:item}):", 33 | "\t${0:# code...}", 34 | "endforeach;" 35 | ], 36 | "description": "Foreach end as $key => $item block" 37 | }, 38 | "For loop": { 39 | "prefix": "forl", 40 | "body": [ 41 | "for (\\$${1:i} = ${2:0}; \\$${1:i} < \\$${3:limit}; \\$${1:i}++) {", 42 | "\t${0:# code...}", 43 | "}" 44 | ], 45 | "description": "For loop" 46 | }, 47 | "For ... end": { 48 | "prefix": "forlen", 49 | "body": [ 50 | "for (\\$${1:i} = ${2:0}; \\$${1:i} < \\$${3:limit}; \\$${1:i}++):", 51 | "\t${0:# code...}", 52 | "endfor;" 53 | ], 54 | "description": "For end loop" 55 | }, 56 | "While loop": { 57 | "prefix": "wl", 58 | "body": [ 59 | "while (\\$${1:variable} ${2:<=} \\$${3:limit}) {", 60 | "\t${0:# code...}", 61 | "}" 62 | ], 63 | "description": "While loop" 64 | }, 65 | "While ... end": { 66 | "prefix": "wlen", 67 | "body": [ 68 | "while (\\$${1:variable} ${2:<=} \\$${3:limit}):", 69 | "\t${0:# code...}", 70 | "endwhile;" 71 | ], 72 | "description": "While end loop" 73 | }, 74 | "Do ... while": { 75 | "prefix": "dowl", 76 | "body": [ 77 | "do {", 78 | "\t${0:# code...}", 79 | "} while (\\$${1:variable} ${2:<=} \\$${3:limit});" 80 | ], 81 | "description": "Do while loop" 82 | } 83 | } -------------------------------------------------------------------------------- /snippets/method.json: -------------------------------------------------------------------------------- 1 | { 2 | "Class constructor": { 3 | "prefix": "pubc", 4 | "body": [ 5 | "public function __construct(${1:Type} \\$${2:args})", 6 | "{", 7 | "\t${0:# code...}", 8 | "}" 9 | ], 10 | "description": "Class public constructor block" 11 | }, 12 | "Class private constructor": { 13 | "prefix": "pric", 14 | "body": [ 15 | "private function __construct(${1:Type} \\$${2:args})", 16 | "{", 17 | "\t${0:# code...}", 18 | "}" 19 | ], 20 | "description": "Class private constructor block" 21 | }, 22 | "Class protected constructor": { 23 | "prefix": "proc", 24 | "body": [ 25 | "protected function __construct(${1:Type} \\$${2:args})", 26 | "{", 27 | "\t${0:# code...}", 28 | "}" 29 | ], 30 | "description": "Class protected constructor block" 31 | }, 32 | "Private method": { 33 | "prefix": "prif", 34 | "body": [ 35 | "private function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 36 | "{", 37 | "\t${0:# code...}", 38 | "}" 39 | ], 40 | "description": "Private method block" 41 | }, 42 | "Private static method": { 43 | "prefix": "prisf", 44 | "body": [ 45 | "private static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 46 | "{", 47 | "\t${0:# code...}", 48 | "}" 49 | ], 50 | "description": "Private static method block" 51 | }, 52 | "Final private method": { 53 | "prefix": "fprif", 54 | "body": [ 55 | "final private function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 56 | "{", 57 | "\t${0:# code...}", 58 | "}" 59 | ], 60 | "description": "Final private method block" 61 | }, 62 | "Final private static method": { 63 | "prefix": "fprisf", 64 | "body": [ 65 | "final private static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 66 | "{", 67 | "\t${0:# code...}", 68 | "}" 69 | ], 70 | "description": "Final private static method block" 71 | }, 72 | "Protected method": { 73 | "prefix": "prof", 74 | "body": [ 75 | "protected function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 76 | "{", 77 | "\t${0:# code...}", 78 | "}" 79 | ], 80 | "description": "Protected method block" 81 | }, 82 | "Protected static method": { 83 | "prefix": "prosf", 84 | "body": [ 85 | "protected static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 86 | "{", 87 | "\t${0:# code...}", 88 | "}" 89 | ], 90 | "description": "Protected static method block" 91 | }, 92 | "Final protected method": { 93 | "prefix": "fprof", 94 | "body": [ 95 | "final protected function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 96 | "{", 97 | "\t${0:# code...}", 98 | "}" 99 | ], 100 | "description": "Final protected method block" 101 | }, 102 | "Final protected static method": { 103 | "prefix": "fprosf", 104 | "body": [ 105 | "final protected static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 106 | "{", 107 | "\t${0:# code...}", 108 | "}" 109 | ], 110 | "description": "Final protected static method block" 111 | }, 112 | "Abstract protected method": { 113 | "prefix": "aprof", 114 | "body": [ 115 | "abstract protected function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void};" 116 | ], 117 | "description": "Abstract protected method statement" 118 | }, 119 | "Abstract protected static method": { 120 | "prefix": "aprosf", 121 | "body": [ 122 | "abstract protected static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void};" 123 | ], 124 | "description": "Abstract protected static method statement" 125 | }, 126 | "Public method": { 127 | "prefix": "pubf", 128 | "body": [ 129 | "public function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 130 | "{", 131 | "\t${0:# code...}", 132 | "}" 133 | ], 134 | "description": "Public method block" 135 | }, 136 | "Public static method": { 137 | "prefix": "pubsf", 138 | "body": [ 139 | "public static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 140 | "{", 141 | "\t${0:# code...}", 142 | "}" 143 | ], 144 | "description": "Public static method block" 145 | }, 146 | "Final public method": { 147 | "prefix": "fpubf", 148 | "body": [ 149 | "final public function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 150 | "{", 151 | "\t${0:# code...}", 152 | "}" 153 | ], 154 | "description": "Final public method block" 155 | }, 156 | "Final public static method": { 157 | "prefix": "fpubsf", 158 | "body": [ 159 | "final public static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void}", 160 | "{", 161 | "\t${0:# code...}", 162 | "}" 163 | ], 164 | "description": "Final public static method block" 165 | }, 166 | "Abstract public method": { 167 | "prefix": "apubf", 168 | "body": [ 169 | "abstract public function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void};" 170 | ], 171 | "description": "Abstract public method statement" 172 | }, 173 | "Abstract public static method": { 174 | "prefix": "apubsf", 175 | "body": [ 176 | "abstract public static function ${1:methodName}(${2:Type} \\$${3:args}): ${4:void};" 177 | ], 178 | "description": "Abstract public static method statement" 179 | } 180 | } -------------------------------------------------------------------------------- /snippets/method.php5.json: -------------------------------------------------------------------------------- 1 | { 2 | "Private method PHP5": { 3 | "prefix": "-prif", 4 | "body": [ 5 | "private function ${1:methodName}(${2:parameters})", 6 | "{", 7 | "\t${0:# code...}", 8 | "}" 9 | ], 10 | "description": "Private method block PHP5" 11 | }, 12 | "Private static method PHP5": { 13 | "prefix": "-prisf", 14 | "body": [ 15 | "private static function ${1:methodName}(${2:parameters})", 16 | "{", 17 | "\t${0:# code...}", 18 | "}" 19 | ], 20 | "description": "Private static method block PHP5" 21 | }, 22 | "Final private method PHP5": { 23 | "prefix": "-fprif", 24 | "body": [ 25 | "final private function ${1:methodName}(${2:parameters})", 26 | "{", 27 | "\t${0:# code...}", 28 | "}" 29 | ], 30 | "description": "Final private method block PHP5" 31 | }, 32 | "Final private static method PHP5": { 33 | "prefix": "-fprisf", 34 | "body": [ 35 | "final private static function ${1:methodName}(${2:parameters})", 36 | "{", 37 | "\t${0:# code...}", 38 | "}" 39 | ], 40 | "description": "Final private static method block PHP5" 41 | }, 42 | "Protected method PHP5": { 43 | "prefix": "-prof", 44 | "body": [ 45 | "protected function ${1:methodName}(${2:parameters})", 46 | "{", 47 | "\t${0:# code...}", 48 | "}" 49 | ], 50 | "description": "Protected method block PHP5" 51 | }, 52 | "Protected static method PHP5": { 53 | "prefix": "-prosf", 54 | "body": [ 55 | "protected static function ${1:methodName}(${2:parameters})", 56 | "{", 57 | "\t${0:# code...}", 58 | "}" 59 | ], 60 | "description": "Protected static method block PHP5" 61 | }, 62 | "Final protected method PHP5": { 63 | "prefix": "-fprof", 64 | "body": [ 65 | "final protected function ${1:methodName}(${2:parameters})", 66 | "{", 67 | "\t${0:# code...}", 68 | "}" 69 | ], 70 | "description": "Final protected method block PHP5" 71 | }, 72 | "Final protected static method PHP5": { 73 | "prefix": "-fprosf", 74 | "body": [ 75 | "final protected static function ${1:methodName}(${2:parameters})", 76 | "{", 77 | "\t${0:# code...}", 78 | "}" 79 | ], 80 | "description": "Final protected static method block PHP5" 81 | }, 82 | "Abstract protected method PHP5": { 83 | "prefix": "-aprof", 84 | "body": [ 85 | "abstract protected function ${1:methodName}(${2:parameters});" 86 | ], 87 | "description": "Abstract protected method statement PHP5" 88 | }, 89 | "Abstract protected static method PHP5": { 90 | "prefix": "-aprosf", 91 | "body": [ 92 | "abstract protected static function ${1:methodName}(${2:parameters});" 93 | ], 94 | "description": "Abstract protected static method statement PHP5" 95 | }, 96 | "Public method PHP5": { 97 | "prefix": "-pubf", 98 | "body": [ 99 | "public function ${1:methodName}(${2:parameters})", 100 | "{", 101 | "\t${0:# code...}", 102 | "}" 103 | ], 104 | "description": "Public method block PHP5" 105 | }, 106 | "Public static method PHP5": { 107 | "prefix": "-pubsf", 108 | "body": [ 109 | "public static function ${1:methodName}(${2:parameters})", 110 | "{", 111 | "\t${0:# code...}", 112 | "}" 113 | ], 114 | "description": "Public static method block PHP5" 115 | }, 116 | "Final public method PHP5": { 117 | "prefix": "-fpubf", 118 | "body": [ 119 | "final public function ${1:methodName}(${2:parameters})", 120 | "{", 121 | "\t${0:# code...}", 122 | "}" 123 | ], 124 | "description": "Final public method block PHP5" 125 | }, 126 | "Final public static method PHP5": { 127 | "prefix": "-fpubsf", 128 | "body": [ 129 | "final public static function ${1:methodName}(${2:parameters})", 130 | "{", 131 | "\t${0:# code...}", 132 | "}" 133 | ], 134 | "description": "Final public static method block PHP5" 135 | }, 136 | "Abstract public method PHP5": { 137 | "prefix": "-apubf", 138 | "body": [ 139 | "abstract public function ${1:methodName}(${2:parameters});" 140 | ], 141 | "description": "Abstract public method statement PHP5" 142 | }, 143 | "Abstract public static method PHP5": { 144 | "prefix": "-apubsf", 145 | "body": [ 146 | "abstract public static function ${1:methodName}(${2:parameters});" 147 | ], 148 | "description": "Abstract public static method statement PHP5" 149 | } 150 | } -------------------------------------------------------------------------------- /snippets/statement.json: -------------------------------------------------------------------------------- 1 | { 2 | "define": { 3 | "prefix": "df", 4 | "body": [ 5 | "define(\"${1:CONSTANT}\", \"${2:value}\");" 6 | ], 7 | "description": "'define' call" 8 | }, 9 | "include": { 10 | "prefix": "inc", 11 | "body": [ 12 | "include ${1:__DIR__.}'${2:path_to_filename}';" 13 | ], 14 | "description": "'include' statement" 15 | }, 16 | "include_once": { 17 | "prefix": "inco", 18 | "body": [ 19 | "include_once ${1:__DIR__.}'${2:path_to_filename}';" 20 | ], 21 | "description": "'include_once' statement" 22 | }, 23 | "require": { 24 | "prefix": "rqr", 25 | "body": [ 26 | "require ${1:__DIR__.}'${2:path_to_filename}';" 27 | ], 28 | "description": "'require' statement" 29 | }, 30 | "require_once": { 31 | "prefix": "rqro", 32 | "body": [ 33 | "require_once ${1:__DIR__.}'${2:path_to_filename}';" 34 | ], 35 | "description": "'require_once' statement" 36 | }, 37 | "echo": { 38 | "prefix": "eco", 39 | "body": [ 40 | "echo \"${1:text}\";" 41 | ], 42 | "description": "'echo' statement" 43 | }, 44 | "print_r": { 45 | "prefix": "pr", 46 | "body": [ 47 | "print_r(\\$${1:variable});" 48 | ], 49 | "description": "'print_r' call" 50 | }, 51 | "var_dump": { 52 | "prefix": "vd", 53 | "body": [ 54 | "var_dump(\\$${1:variable});" 55 | ], 56 | "description": "'var_dump' call" 57 | }, 58 | "var_export": { 59 | "prefix": "vx", 60 | "body": [ 61 | "var_export(\\$${1:variable});" 62 | ], 63 | "description": "'var_export' call" 64 | } 65 | } -------------------------------------------------------------------------------- /snippets/tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "PHP tags": { 3 | "prefix": "php", 4 | "body": [ 5 | "" 6 | ], 7 | "description": "PHP open tag" 8 | }, 9 | "PHP open tag": { 10 | "prefix": "po", 11 | "body": [ 12 | "" 20 | ], 21 | "description": "PHP close tag" 22 | }, 23 | "PHP echo short tag": { 24 | "prefix": "peco", 25 | "body": [ 26 | "" 27 | ], 28 | "description": "PHP echo short tag" 29 | } 30 | } --------------------------------------------------------------------------------