Skip to content

Commit fa11911

Browse files
committed
feat: add php class snippets for php and html
1 parent 75a8e25 commit fa11911

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ You can use it to avoid wasting time typing Class blocks, function signatures or
1212
## Snippets
1313

1414
### Class related
15-
| Snippet | Output |
16-
| --- | --- |
17-
| phpclass | `standard php class` |
15+
| Snippet | Output | Language
16+
| --- | --- | --- |
17+
| phpclass | `standard php class` | html+php |
18+
| phpclano | `php class without strict type and namespace` | html |
19+
| phpclanostr | `php class without strict type` | html |
20+
| phpclanonam | `php class without namespace` | html |
1821

1922
## Special Thanks
2023
This extension is forked from [h4kst3r/php-awesome-snippets](https://github.com/h4kst3r/php-awesome-snippets). Because its author seems to have not maintained it for a long time. So I made this fork to make the extension suitable for new version of PHP. I re-planned the shortcut keys, and add more standardized writing methods. Great thanks to h4kst3r's excellent work.

snippets/html/class.json

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"php class": {
3-
"prefix": "phpclass",
3+
"prefix": "phpcla",
44
"body": [
55
"<?php",
66
"",
@@ -11,8 +11,44 @@
1111
"class $TM_FILENAME_BASE",
1212
"{",
1313
" $0",
14-
"}"
14+
"}",
15+
""
1516
],
1617
"description": "php class"
18+
},
19+
"php class no": {
20+
"prefix": "phpclano",
21+
"body": ["<?php", "", "class $TM_FILENAME_BASE", "{", " $0", "}", ""],
22+
"description": "php class without strict type and namespace"
23+
},
24+
"php class no strict": {
25+
"prefix": "phpclanostr",
26+
"body": [
27+
"<?php",
28+
"",
29+
"namespace $1;",
30+
"",
31+
"class $TM_FILENAME_BASE",
32+
"{",
33+
" $0",
34+
"}",
35+
""
36+
],
37+
"description": "php class without strict type"
38+
},
39+
"php class no namespace": {
40+
"prefix": "phpclanonam",
41+
"body": [
42+
"<?php",
43+
"",
44+
"declare(strict_types=1);",
45+
"",
46+
"class $TM_FILENAME_BASE",
47+
"{",
48+
" $0",
49+
"}",
50+
""
51+
],
52+
"description": "php class without namespace"
1753
}
1854
}

snippets/php/class.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"php class": {
3+
"prefix": "phpcla",
4+
"body": ["class $TM_FILENAME_BASE", "{", " $0", "}", ""],
5+
"description": "php class"
6+
}
7+
}

0 commit comments

Comments
 (0)