PHP snippets
This extension contains code snippets for [Vs Code][code] editor (supports PHP).
Installation
- Open the extensions sidebar on Visual Studio Code
- Search for php snippets
- Click Install
- 🌟🌟🌟🌟🌟 Rate five-stars 😃
The languages supported (file extensions)
Snippets
Snippets are optimized to be short and easy to remember.
Below is a list of all available snippets and the triggers of each one. The ⇥ means the TAB key.
Import and export
Trigger |
Content |
eco⇥ |
echo ""; statement. |
pri⇥ |
print($ex); statement. |
dump⇥ |
var_dump($ex) statement |
pre_dump⇥ |
echo '<pre>';\nvardump($ex); \necho '</pre>'; formated var_dump output |
fore⇥ |
foreach(iterable_expr as $value) {...} |
forek⇥ |
foreach(iterable_expr as $key => $value) {... |
prif⇥ |
private function name() {} |
prisf⇥ |
private static function name() {} |
prof⇥ |
protected function name() {} |
prosf⇥ |
protected static function name() {} |
pubf⇥ |
public function name() {} |
pubsf⇥ |
public static function name() {} |
fn⇥ |
fn($x) => $x * 10 Arrow function |
inc⇥ |
include $file include filename |
inco⇥ |
include_one $file include_one filename |
req⇥ |
require $file require filename |
reqo⇥ |
require_once $file require_once filename |
thr⇥ |
throw new $0 throw an exception |
ns⇥ |
namespace App; namespace App is an example |
mt⇥ |
match($ex) {...} match expression |
G⇥ |
$_GET['var'] $_GET Superglobal |
P⇥ |
$_POST['var'] $_POST Superglobal |
SE⇥ |
$_SERVER['var'] $_SERVER Superglobal |
SESS⇥ |
$_SESSION['var'] $_SESSION Superglobal |
REQ⇥ |
$_REQUEST['var'] $_REQUEST Superglobal |
FI⇥ |
$_FILE['var']['name'] $_FILE Superglobal |
Issues & Suggestions
For any issues or suggestions, please use GitHub issues.
Happy coding _ PHP developer _
| |