Last active
March 23, 2022 22:02
-
-
Save james2doyle/b70e4379a12bcec504c58a7f6579473f to your computer and use it in GitHub Desktop.
Nova 9 PHP Clips (completions, snippets) for common flow controls, variables, globals, functions, methods, documentation, and classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"clips": [ | |
{ | |
"content": "/** @var ${1:class/type} ${2:description} */", | |
"name": "Var Documentation", | |
"scope": "editor", | |
"syntax": "php", | |
"trigger": "@var" | |
}, | |
{ | |
"content": "/** @todo ${1:description} */", | |
"name": "Todo Documentation", | |
"scope": "editor", | |
"syntax": "php", | |
"trigger": "@todo" | |
}, | |
{ | |
"content": "\\$_COOKIE['${1:variable}']", | |
"trigger": "\\$_COOKIE", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "COOKIE['...']" | |
}, | |
{ | |
"content": "\\$_ENV['${1:variable}']", | |
"trigger": "\\$_ENV", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "ENV['...']" | |
}, | |
{ | |
"content": "\\$_FILES['${1:variable}']", | |
"trigger": "\\$_FILES", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "FILES['...']" | |
}, | |
{ | |
"content": "\\$_GET['${1:variable}']", | |
"trigger": "\\$_GET", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "GET['...']" | |
}, | |
{ | |
"content": "\\$_POST['${1:variable}']", | |
"trigger": "\\$_POST", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "POST['...']" | |
}, | |
{ | |
"content": "\\$_REQUEST['${1:variable}']", | |
"trigger": "\\$_REQUEST", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "REQUEST['...']" | |
}, | |
{ | |
"content": "\\$_SERVER['${1:variable}']", | |
"trigger": "\\$_SERVER", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "SERVER['...']" | |
}, | |
{ | |
"content": "\\$_SESSION['${1:variable}']", | |
"trigger": "\\$_SESSION", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "SESSION['...']" | |
}, | |
{ | |
"content": "\\$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}$0", | |
"trigger": "globals", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "$GLOBALS['...']" | |
}, | |
{ | |
"content": "/**\n * $1\n */\nclass ${2:ClassName}${3: extends ${4:AnotherClass}}\n{\n\t$5\n\tfunction ${6:__construct}(${7:argument})\n\t{\n\t\t${0:// code...}\n\t}\n}", | |
"trigger": "class", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "class ..." | |
}, | |
{ | |
"content": "function __construct(${1:\\$${2:foo}${3: = ${4:null}}})\n{\n\t${2/.+/$this->$0 = \\$$0;/}$0\n}", | |
"trigger": "con", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "function __construct" | |
}, | |
{ | |
"comment": {}, | |
"content": "declare(strict_types=${1:1});$0", | |
"trigger": "decl", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "declare strict_types" | |
}, | |
{ | |
"content": "define('$1', ${2:'$3'});\n$0", | |
"trigger": "def", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "define(..., ...)" | |
}, | |
{ | |
"content": "$1defined('$2')$0", | |
"trigger": "def?", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "defined(...)" | |
}, | |
{ | |
"content": "do {\n\t${0:// code...}\n} while (${1:condition});", | |
"trigger": "do", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "do ... while ..." | |
}, | |
{ | |
"content": "echo \"${1:string}\";", | |
"trigger": "echo", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "echo \"...\"" | |
}, | |
{ | |
"content": "elseif (${1:condition}) {\n\t${0:// code...}\n}", | |
"trigger": "elseif", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "elseif ..." | |
}, | |
{ | |
"comment": {}, | |
"content": "fn ($1)$2 => $0", | |
"trigger": "fn", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "fn ..." | |
}, | |
{ | |
"content": "for (\\$${1:i}=${2:0}; \\$${1:i} < $3; \\$${1:i}++) {\n\t${0:// code...}\n}", | |
"trigger": "for", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "for ..." | |
}, | |
{ | |
"content": "foreach (\\$${1:variable} as \\$${2:key}${3: => \\$${4:value}}) {\n\t${0:// code...}\n}", | |
"trigger": "foreach", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "foreach ..." | |
}, | |
{ | |
"content": "${1:public }function ${2:FunctionName}(${3:\\$${4:value}${5:=''}})\n{\n\t${0:// code...}\n}", | |
"trigger": "fun", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "function ..." | |
}, | |
{ | |
"content": "if (${1:condition}) {\n\t${2:// code...}\n} else {\n\t${3:// code...}\n}\n$0", | |
"trigger": "ifelse", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "if ... else ..." | |
}, | |
{ | |
"content": "if (${1:condition}) {\n\t${0:// code...}\n}", | |
"trigger": "if", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "if ..." | |
}, | |
{ | |
"content": "\\$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;", | |
"trigger": "if?", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "$... = ( ... ) ? ... : ..." | |
}, | |
{ | |
"content": "include '${1:file}';$0", | |
"trigger": "incl", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "include ..." | |
}, | |
{ | |
"content": "include_once '${1:file}';$0", | |
"trigger": "incl1", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "include_once ..." | |
}, | |
{ | |
"comment": {}, | |
"content": "match (${1:variable}) {\n\t${2:from} => ${3:to},$5\n\tdefault => ${4:null},\n}$0", | |
"trigger": "match", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "match ..." | |
}, | |
{ | |
"content": "\\$${1:arrayName} = array('$2' => $3${4:,} $0);", | |
"trigger": "array", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "$... = array (...)" | |
}, | |
{ | |
"content": "${php} $0 ?>", | |
"trigger": "php", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php ... ?>" | |
}, | |
{ | |
"content": "<?php $this->$0 ?>", | |
"trigger": "this", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php $this->... ?>" | |
}, | |
{ | |
"content": "<?${php echo} $this->$0 ?>", | |
"trigger": "ethis", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php echo $this->... ?>" | |
}, | |
{ | |
"content": "<?${php echo} ${1:$var} ?>$0", | |
"trigger": "echo", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php echo ... ?>" | |
}, | |
{ | |
"content": "<?${php echo} htmlentities(${1:$var}, ENT_QUOTES, 'utf-8') ?>$0", | |
"trigger": "echoh", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php echo htmlentities(...) ?>" | |
}, | |
{ | |
"content": "<?php else: ?>", | |
"trigger": "else", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php else: ?>" | |
}, | |
{ | |
"content": "<?php foreach (\\$${1:variable} as \\$${2:key}${3: => \\$${4:value}}): ?>\n\t\n<?php endforeach ?>", | |
"trigger": "foreach", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php foreach (...) ... <?php endforeach ?>" | |
}, | |
{ | |
"content": "<?php if (${1:condition}): ?>\n\t$2\n<?php else: ?>\n\t$0\n<?php endif ?>", | |
"trigger": "ifelse", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php if (...) ?> ... <?php else ?> ... <?php endif ?>" | |
}, | |
{ | |
"content": "<?php if (${1:condition}): ?>\n\t$0\n<?php endif ?>", | |
"trigger": "if", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php if (...) ?> ... <?php endif ?>" | |
}, | |
{ | |
"content": "<?php $0 ?>", | |
"trigger": "php", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "<?php ... ?>" | |
}, | |
{ | |
"content": "/**\n * ${3:undocumented class variable}\n *\n * @var ${4:string}\n **/\n${1:var} \\$$2;$0", | |
"trigger": "doc_v", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Class Variable" | |
}, | |
{ | |
"content": "/**\n * ${3:undocumented class}\n *\n * @package ${4:default}\n * @author ${PHPDOC_AUTHOR:$TM_FULLNAME}\n **/\n$1class $2\n{$0\n} // END $1class $2", | |
"trigger": "doc_c", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Class" | |
}, | |
{ | |
"content": "/**\n * ${3:undocumented constant}\n **/\ndefine($1, $2);$0", | |
"trigger": "doc_d", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Constant Definition" | |
}, | |
{ | |
"content": "/**\n * ${4:undocumented function}\n *\n * @return ${5:void}\n * @author ${PHPDOC_AUTHOR:$TM_FULLNAME}$6\n **/\n$1function $2($3);$0", | |
"trigger": "doc_s", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Function Signature" | |
}, | |
{ | |
"content": "/**\n * ${4:undocumented function}\n *\n * @return ${5:void}\n * @author ${PHPDOC_AUTHOR:$TM_FULLNAME}$6\n **/\n$1function $2($3)\n{$0\n}", | |
"trigger": "doc_f", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Function" | |
}, | |
{ | |
"content": "/**\n * ${2:undocumented class}\n *\n * @package ${3:default}\n * @author ${PHPDOC_AUTHOR:$TM_FULLNAME}\n **/\ninterface $1\n{$0\n} // END interface $1", | |
"trigger": "doc_i", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Interface" | |
}, | |
{ | |
"content": "require '${1:file}';$0", | |
"trigger": "req", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "require ..." | |
}, | |
{ | |
"content": "require_once '${1:file}';$0", | |
"trigger": "req1", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "require_once ..." | |
}, | |
{ | |
"content": "return$1;$0", | |
"trigger": "ret", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "return" | |
}, | |
{ | |
"content": "return false;$0", | |
"trigger": "ret0", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "return false" | |
}, | |
{ | |
"content": "return true;$0", | |
"trigger": "ret1", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "return true" | |
}, | |
{ | |
"content": "/**\n * $0\n */", | |
"trigger": "/**", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Start Docblock" | |
}, | |
{ | |
"content": "case '${1:variable}':\n\t${0:// code...}\n\tbreak;", | |
"trigger": "case", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "case ..." | |
}, | |
{ | |
"content": "switch (${1:variable}) {\n\tcase '${2:value}':\n\t\t${3:// code...}\n\t\tbreak;\n\t$0\n\tdefault:\n\t\t${4:// code...}\n\t\tbreak;\n}", | |
"trigger": "switch", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "switch ..." | |
}, | |
{ | |
"content": "throw new $1Exception(${2:\"${3:Error Processing Request}\"}${4:, ${5:1}});\n$0", | |
"trigger": "throw", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Throw Exception" | |
}, | |
{ | |
"content": "${TM_SELECTED_TEXT/([\\t ]*).*/$1/m}try {\n\t${3:${TM_SELECTED_TEXT/(\\A.*)|(.+)|\\n\\z/(?1:$0:(?2:\\t$0))/g}}\n${TM_SELECTED_TEXT/([\\t ]*).*/$1/m}} catch (${1:Exception} ${2:$e}) {\n${TM_SELECTED_TEXT/([\\t ]*).*/$1/m}\t$0\n${TM_SELECTED_TEXT/([\\t ]*).*/$1/m}}", | |
"trigger": "try", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "Wrap in try { ... } catch (...) { ... }" | |
}, | |
{ | |
"content": "while (${1:condition}) {\n\t${0:// code...}\n}", | |
"trigger": "while", | |
"scope": "editor", | |
"syntax": "php", | |
"name": "while ..." | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment