Skip to content

Instantly share code, notes, and snippets.

@vmitchell85
Created March 3, 2022 16:04
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 vmitchell85/571835f2db69a6f726a6669bea2638dc to your computer and use it in GitHub Desktop.
Save vmitchell85/571835f2db69a6f726a6669bea2638dc to your computer and use it in GitHub Desktop.
Vince's PHP Snippets for VsCode
{
// Place your snippets for php here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"ray": {
"prefix": "rr",
"body": [
"ray(${1:'${TM_FILENAME_BASE}: ${TM_LINE_NUMBER:here}'})$2;",
],
"description": "Dump data to Spatie's Ray application"
},
"ray model": {
"prefix": "rrm",
"body": [
"ray()->model($1);",
],
"description": "Dump a Model to Spatie's Ray application"
},
"ray clear": {
"prefix": "rrc",
"body": [
"ray()->newScreen($1);",
],
"description": "New Screen in Spatie's Ray application"
},
"guarded id": {
"prefix": "pgid",
"body": [
"protected \\$guarded = ['id'];",
],
"description": "Set guarded to just the id"
},
"logger line number": {
"prefix": "loglin",
"body": [
"logger('${TM_FILENAME_BASE}: ${TM_LINE_NUMBER:here}');",
],
"description": "Add log message with line number"
},
"logger json": {
"prefix": "logjson",
"body": [
"logger('${TM_FILENAME_BASE}: ${TM_LINE_NUMBER:here} -- ' . json_encode($1));",
],
"description": "Add log message with line number"
},
"public method": {
"prefix": "met",
"body": [
"public function $1()",
"{",
"\t$2",
"}"
],
"description": "A basic public method template"
},
"test method": {
"prefix": "tst",
"body": [
"/** @test */",
"public function ${2:the_one_where}()",
"{",
"\t$3",
"}"
],
"description": "Plain Test Case Method"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment