Skip to content

Instantly share code, notes, and snippets.

@ShiponKarmakar
Last active August 7, 2019 08:49
Show Gist options
  • Save ShiponKarmakar/b68d61d065bc17d9e79cf53d79ed8685 to your computer and use it in GitHub Desktop.
Save ShiponKarmakar/b68d61d065bc17d9e79cf53d79ed8685 to your computer and use it in GitHub Desktop.
VS code PHP User Snippet
{
// Function
"function": {
"prefix": "function",
"body": [
"function $1() {",
" $2",
"}",
],
"description": "Normal Function"
},
// If Else
"if-": {
"prefix": "if",
"body": [
"if ( $1 ){",
" $2",
"}",
],
"description": "if condition"
},
// Echo
"echo": {
"prefix": "echo",
"body": [
"echo \"$1\";"
],
"description": "Echo"
},
// Class
"class": {
"prefix": "class",
"body": [
"class $1 {",
" $2",
"}"
],
"description": "Class"
},
// DEFINE ABSPATH
"ABSPATH": {
"prefix": "ABSPATH",
"body": [
"defined( 'ABSPATH' ) or ( 'Hey, What are you doing here? you silly human!' );"
],
"description": "ABSPATH Define "
},
// register_activation_hook( __FILE__ , 'activate' );
"register_activation_hook": {
"prefix": "register_activation_hook",
"body": [
"register_activation_hook( __FILE__ , 'activate' );"
],
"description": "register_activation_hook( __FILE__ , $function )"
},
// Define
"define": {
"prefix": "define",
"body": [
"define( '$1', '$2' );"
],
"description": "define( '', '' );"
},
// Public Method
"public-f": {
"prefix": "public-f",
"body": [
"public function $1() {",
" $2",
"}"
],
"description": "public function"
},
// private Method
"private-f": {
"prefix": "private-f",
"body": [
"private function $1() {",
" $2",
"}"
],
"description": "public function"
},
// Protected Method
"Protected-f": {
"prefix": "Protected-f",
"body": [
"Protected function $1() {",
" $2",
"}"
],
"description": "public function"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment