Skip to content

Instantly share code, notes, and snippets.

@tuanpht
Last active July 19, 2021 07:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuanpht/0b2df968c628feee97c72e0ee760b227 to your computer and use it in GitHub Desktop.
Save tuanpht/0b2df968c628feee97c72e0ee760b227 to your computer and use it in GitHub Desktop.
VS Code PHP snippet insert namespace, class, constructor
{
"Insert namespace": {
"prefix": "name",
"body": ["namespace $1${TM_DIRECTORY/[\\/]/\\\\/g};", "$2"]
},
"Construct": {
"prefix": "cons",
"body": ["${1:public} function __construct()", "{$2\n}$0"]
},
"Class": {
"prefix": "cl",
"body": [
"class ${TM_FILENAME/\\.php$//} ${2:extends ${3:AnotherClass}} ${4:implements ${5:SomeInterface}}",
"{",
"\t// $0",
"}"
]
},
"Magento error_log": {
"prefix": "mage_err",
"body": [
"error_log(time() . ' - ' . print_r(${1:yourVariable}, true) . PHP_EOL, 3, BP . '${2:/var/log/dev.debug.log}');"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment