Skip to content

Instantly share code, notes, and snippets.

@channaveer
Created August 15, 2019 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save channaveer/e54442c26a792ed242a0a9b784695930 to your computer and use it in GitHub Desktop.
Save channaveer/e54442c26a792ed242a0a9b784695930 to your computer and use it in GitHub Desktop.
VSCODE PHP Snippets
{
"Custom For Loop": {
"prefix": "feach",
"body": [
"foreach ($1 as $2) {",
"\t$3",
"}"
],
"description": "Custom For Loop"
},
"Custom If Condition": {
"prefix": "if",
"body": [
"if ($1) {",
"\t$2",
"}"
],
"description": "Custom If Condition"
},
"Custom ElseIf Condition": {
"prefix": "ife",
"body": [
"if ($1) {",
"\t$2",
"} else {",
"\t$3",
"}"
],
"description": "Custom ElseIf Condition"
},
"Custom Public Function": {
"prefix": "func",
"body": [
"public function $1() {",
"\t$2",
"}"
],
"description": "Custom Public Function"
},
"Custom Private Function": {
"prefix": "pfunc",
"body": [
"private function $1() {",
"\t$2",
"}"
],
"description": "Custom Private Function"
},
"Custom Protected Function": {
"prefix": "profunc",
"body": [
"protected function $1() {",
"\t$2",
"}"
],
"description": "Custom Protected Function"
},
"Custom Test Function": {
"prefix": "tfunc",
"body": [
"/**",
" * @test",
"*/",
"public function $1() {",
"\t$2",
"}"
],
"description": "Custom PHPUnit Public Test Function"
},
"Test With DataProvider Function": {
"prefix": "tpfunc",
"body": [
"/**",
" * @test",
" * @dataProvider $1",
"*/",
"public function $2() {",
"\t$3",
"}"
],
"description": "Custom PHPUnit DataProvider Test Function"
},
"Test With Depends Function": {
"prefix": "tdfunc",
"body": [
"/**",
" * @test",
" * @depends $1",
"*/",
"public function $2() {",
"\t$3",
"}"
],
"description": "Custom PHPUnit Depends Test Function"
},
"Test With DataProvider & Depends Function": {
"prefix": "tpdfunc",
"body": [
"/**",
" * @test",
" * @dataProvider $1",
" * @depends $2",
"*/",
"public function $3() {",
"\t$4",
"}"
],
"description": "Custom PHPUnit DataProvider & Depends Test Function"
},
}
@channaveer
Copy link
Author

Hey, guys, I would like to share my VS CODE snippets for PHP. Use can use them by looking into the prefix. Hope to add few more in the future.

Eg:

func

will expand to

public function cursor(){

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment