My set of Live Templates for PhpStorm
Latest commit 8286c58 May 21, 2015 @fprochazka Add QOF & QOS
Permalink
Failed to load latest commit information.
Doctrine.xml Add QOF & QOS May 21, 2015
Nette.icls updated Dec 26, 2014
Nette.xml updated Dec 26, 2014
NetteTester.icls updated Dec 26, 2014
NetteTester.xml updated Dec 26, 2014
PHP fprochazka.xml updated Dec 26, 2014
jQuery.icls updated Dec 26, 2014
jQuery.xml updated Dec 26, 2014
readme.md readme: installation fix Dec 26, 2014

readme.md

PhpStorm Live Templates

Installation

First, find your configuration folder.

Windows: <your home directory>\.WebIde<version>\config
Linux: ~\.WebIde<version>\config
MacOS: ~/Library/Preferences/WebIde<version>

On my linux, it would be ~/.WebIde70/config so you have to adjust commands to your platform. There is a templates/ directory. It contains XML files with Live Templates.

Create a git repository in the templates/ dir and pull the templates

$ cd ~/.WebIde50/config/templates/
$ git init
$ git remote add origin git://github.com/fprochazka/phpstorm-livetemplates.git
$ git pull origin master

If this wouldn't work, you should just backup your templates, clone the repo and merge them manually.

Default Shortcuts

  • Insert Live Template - CTRL+J
  • Surround with Live Template - CTRL+ALT+J

PHP Templates

pri, pro, pub

Private, protected and public method

con

Constructor, that calls parent

thr

Throw expression

try

Surround code with try {} expression

ob

Surround code with output buffering

fc

Surround statement with function call

sta

Static function

The $VISIBILITY$ variable within live template uses enum() helper, so you can choose visibility easily

enum

Nette Templates

com

Nette component factory

form

Component factory with basic Form definition and signal handler

ren, act

Render and action method

inj

Inject method for Nette presenter

sup

Startup method

sig

Signal method of Nette PresenterComponent

att

Attached event on Nette component.

obj

Code for including Nette\ObjectMixin into current class

PHPUnit Templates

test

Default empty test function for PhpUnit (todo: more)

jQuery Templates

fn

Common pattern for creating jQuery modules