You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This extension provide a fullset of snippets for PHP devs. You can use it to avoid wasting time typing Class blocks, function signatures or other common PHP statements.
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.
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 standard provided by [PHP-FIG](https://www.php-fig.org/).
17
21
@@ -21,8 +25,11 @@ This work is inspired by PHPstorm (*PHP Live Templates*) and other works availab
21
25
22
26
## Usage
23
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
+
24
29
> ***Tip:*** Snippets provided in this extension support `tab` to next/previous placeholder.
25
30
31
+
These snippets are meant to work in *PHP* context (VScode file). However there are also available in *Plain Text* files for convenience and PHP tags are available in *HTML* one.
32
+
26
33
## Features
27
34
28
35
These snippets try to be **as intuitive as possible** and to avoid conflicts with previous or built-in snippets.
@@ -74,10 +81,10 @@ Placeholders are quite *'easy to use'* though some need optimizations.
74
81
| Snippet | Output |
75
82
| --- | --- |
76
83
| eco |`echo "...";`|
77
-
| inc |`include '...';`|
78
-
| inco |`include_once '...';`|
79
-
| rqr |`require '...';`|
80
-
| rqro |`require_once '...';`|
84
+
| inc |`include __DIR__.'...';`|
85
+
| inco |`include_once __DIR__.'...';`|
86
+
| rqr |`require __DIR__.'...';`|
87
+
| rqro |`require_once __DIR__.'...';`|
81
88
| df |`define("...", "...");`|
82
89
| pr |`print_r(...);`|
83
90
| vd |`var_dump(...);`|
@@ -92,9 +99,9 @@ Placeholders are quite *'easy to use'* though some need optimizations.
92
99
| fna |`function (Type $args): void {...}`|
93
100
| fnu |`function (Type $args) use ($vars): void {...}`|
94
101
95
-
> ***Tip:*** You can call the `functions` snippets above without type hinting
102
+
> ***Tip:*** You can call `functions` snippets above without type hinting
96
103
> and return type (**PHP5 compatible**) by using **`-`** as prefix.
97
-
> *`-fna` for `function ($args) {...}`
104
+
> *`-fna` for `function ($args) {...}`*(anonymous function block)*
98
105
99
106
----
100
107
### Control structures
@@ -108,7 +115,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
108
115
| cs |`case 'label': ... break;`*[1]*|
109
116
| tern |`condition ? if_true : if_false;`|
110
117
111
-
###### *[1]* Addon snippet: use with `sw` snippet to add `case` if needed.
118
+
***[1]** Addon snippet: use with `sw` snippet to add `case` if needed.
112
119
113
120
> ***Tip:*** The others `if``else` forms are also available if needed:
114
121
>
@@ -186,7 +193,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
186
193
> *`aprof` for `abstract protected function methodName(Type $args): void {...}`
187
194
> *`fpubsf` for `final public static function methodName(Type $args): void {...}`
188
195
189
-
> ***Tip:*** You can call the `methods` snippets above without type hinting
196
+
> ***Tip:*** You can call `methods` snippets above without type hinting
190
197
> and return type (**PHP5 compatible**) by using **`-`** as prefix.
191
198
> *`-apubf` for `abstract public function methodName(parameters) {...}`
192
199
@@ -208,11 +215,11 @@ Placeholders are quite *'easy to use'* though some need optimizations.
208
215
209
216
All you need is VScode installed on your machine.
210
217
211
-
* Install the extension from the extension menu.
218
+
* Install the extension from extension menu.
212
219
213
220
* You can also press `F1` then type:
214
221
215
-
`ext install php-awesome-snippets`
222
+
`ext install hakcorp.php-awesome-snippets`
216
223
217
224
## <aid="ext-settings"></a>Extension Settings
218
225
@@ -229,4 +236,8 @@ Sometimes IntelliSense freezes loading or simply don't select the called snippet
229
236
230
237
## Release Notes
231
238
232
-
All notable changes to this project will be documented in [CHANGELOG.md](https://github.com/h4kst3r/php-awesome-snippets/blob/master/CHANGELOG.md).
239
+
All notable changes to this project will be documented in [CHANGELOG.md](https://github.com/h4kst3r/php-awesome-snippets/blob/master/CHANGELOG.md).
0 commit comments