Skip to content

Commit 7766f1c

Browse files
committed
Merge branch 'dev-master'; before public release
2 parents 7abc3c4 + 104b25c commit 7766f1c

File tree

6 files changed

+104
-20
lines changed

6 files changed

+104
-20
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHP awesome snippets - VScode extension
22

3-
[![VScode](https://img.shields.io/badge/Extension-VScode-blueviolet.svg)]()
3+
[![VScode](https://img.shields.io/badge/Extension-VScode-blueviolet.svg)](https://marketplace.visualstudio.com/items?itemName=hakcorp.php-awesome-snippets)
44
![Snippets](https://img.shields.io/badge/Type-Snippets-yellow.svg)
55
![PHP7](https://img.shields.io/badge/PHP-%5E7.0-blue.svg)
66
![PHP5](https://img.shields.io/badge/PHP-%5E5.4-blue.svg)
@@ -11,7 +11,11 @@
1111

1212
[![SemVer](https://img.shields.io/badge/dynamic/json.svg?color=B71C1C&label=SemVer&query=%24.version&url=https%3A%2F%2Fgithub.com%2Fh4kst3r%2Fphp-awesome-snippets%2Fblob%2Fmaster%2Fpackage.json)](https://github.com/h4kst3r/php-awesome-snippets/blob/master/CHANGELOG.md)
1313

14-
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.
17+
18+
![Demo PHP awesome snippet](https://github.com/h4kst3r/php-awesome-snippets/blob/master/img/snipdemo.gif)
1519

1620
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/).
1721

@@ -21,8 +25,11 @@ This work is inspired by PHPstorm (*PHP Live Templates*) and other works availab
2125

2226
## Usage
2327
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+
2429
> ***Tip:*** Snippets provided in this extension support `tab` to next/previous placeholder.
2530
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+
2633
## Features
2734

2835
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.
7481
| Snippet | Output |
7582
| --- | --- |
7683
| 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__.'...';` |
8188
| df | `define("...", "...");` |
8289
| pr | `print_r(...);` |
8390
| vd | `var_dump(...);` |
@@ -92,9 +99,9 @@ Placeholders are quite *'easy to use'* though some need optimizations.
9299
| fna | `function (Type $args): void {...}` |
93100
| fnu | `function (Type $args) use ($vars): void {...}` |
94101

95-
> ***Tip:*** You can call the `functions` snippets above without type hinting
102+
> ***Tip:*** You can call `functions` snippets above without type hinting
96103
> and return type (**PHP5 compatible**) by using **`-`** as prefix.
97-
> * `-fna` for `function ($args) {...}`
104+
> * `-fna` for `function ($args) {...}` *(anonymous function block)*
98105
99106
----
100107
### Control structures
@@ -108,7 +115,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
108115
| cs | `case 'label': ... break;` *[1]* |
109116
| tern | `condition ? if_true : if_false;` |
110117

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.
112119

113120
> ***Tip:*** The others `if` `else` forms are also available if needed:
114121
>
@@ -186,7 +193,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
186193
> * `aprof` for `abstract protected function methodName(Type $args): void {...}`
187194
> * `fpubsf` for `final public static function methodName(Type $args): void {...}`
188195
189-
> ***Tip:*** You can call the `methods` snippets above without type hinting
196+
> ***Tip:*** You can call `methods` snippets above without type hinting
190197
> and return type (**PHP5 compatible**) by using **`-`** as prefix.
191198
> * `-apubf` for `abstract public function methodName(parameters) {...}`
192199
@@ -208,11 +215,11 @@ Placeholders are quite *'easy to use'* though some need optimizations.
208215

209216
All you need is VScode installed on your machine.
210217

211-
* Install the extension from the extension menu.
218+
* Install the extension from extension menu.
212219

213220
* You can also press `F1` then type:
214221

215-
`ext install php-awesome-snippets`
222+
`ext install hakcorp.php-awesome-snippets`
216223

217224
## <a id="ext-settings"></a>Extension Settings
218225

@@ -229,4 +236,8 @@ Sometimes IntelliSense freezes loading or simply don't select the called snippet
229236

230237
## Release Notes
231238

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).
240+
241+
## License
242+
243+
[MIT](https://github.com/h4kst3r/php-awesome-snippets/blob/master/LICENSE) License

img/php-awesome-icon.png

-377 Bytes
Loading

img/snipdemo.gif

651 KB
Loading

package.json

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "php-awesome-snippets",
33
"displayName": "PHP Awesome Snippets",
44
"version": "1.0.0",
5-
"publisher": "HakCorp",
5+
"publisher": "hakcorp",
66
"description": "A fullset of snippets for PHP devs to boost coding productivity.",
77
"author": {
88
"name": "JH Ster"
@@ -13,7 +13,7 @@
1313
],
1414
"icon": "./img/php-awesome-icon.png",
1515
"galleryBanner": {
16-
"color": "#00b0ff",
16+
"color": "#eceff1",
1717
"theme": "dark"
1818
},
1919
"engines": {
@@ -77,7 +77,59 @@
7777
{
7878
"language": "php",
7979
"path": "./snippets/tag.json"
80+
},
81+
{
82+
"language": "html",
83+
"path": "./snippets/tag.json"
84+
},
85+
{
86+
"language": "plaintext",
87+
"path": "./snippets/array.json"
88+
},
89+
{
90+
"language": "plaintext",
91+
"path": "./snippets/class.json"
92+
},
93+
{
94+
"language": "plaintext",
95+
"path": "./snippets/control.json"
96+
},
97+
{
98+
"language": "plaintext",
99+
"path": "./snippets/error.json"
100+
},
101+
{
102+
"language": "plaintext",
103+
"path": "./snippets/function.json"
104+
},
105+
{
106+
"language": "plaintext",
107+
"path": "./snippets/function.php5.json"
108+
},
109+
{
110+
"language": "plaintext",
111+
"path": "./snippets/globalvar.json"
112+
},
113+
{
114+
"language": "plaintext",
115+
"path": "./snippets/loop.json"
116+
},
117+
{
118+
"language": "plaintext",
119+
"path": "./snippets/method.json"
120+
},
121+
{
122+
"language": "plaintext",
123+
"path": "./snippets/method.php5.json"
124+
},
125+
{
126+
"language": "plaintext",
127+
"path": "./snippets/statement.json"
128+
},
129+
{
130+
"language": "plaintext",
131+
"path": "./snippets/tag.json"
80132
}
81133
]
82134
}
83-
}
135+
}

snippets/statement.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@
99
"include": {
1010
"prefix": "inc",
1111
"body": [
12-
"include '${1:path_to_filename}';"
12+
"include ${1:__DIR__.}'${2:path_to_filename}';"
1313
],
1414
"description": "'include' statement"
1515
},
1616
"include_once": {
1717
"prefix": "inco",
1818
"body": [
19-
"include_once '${1:path_to_filename}';"
19+
"include_once ${1:__DIR__.}'${2:path_to_filename}';"
2020
],
2121
"description": "'include_once' statement"
2222
},
2323
"require": {
2424
"prefix": "rqr",
2525
"body": [
26-
"require '${1:path_to_filename}';"
26+
"require ${1:__DIR__.}'${2:path_to_filename}';"
2727
],
2828
"description": "'require' statement"
2929
},
3030
"require_once": {
3131
"prefix": "rqro",
3232
"body": [
33-
"require_once '${1:path_to_filename}';"
33+
"require_once ${1:__DIR__.}'${2:path_to_filename}';"
3434
],
3535
"description": "'require_once' statement"
3636
},

0 commit comments

Comments
 (0)