Share Your PHPStorm Live Templates

Posted 4 years ago by BenSmith

One of the biggest improvements to my workflow over the last few months has been to create a live template for anything I find myself doing more than twice a day.

This new sub forum seems like a good place to share these templates and I would love to see any you have created and are particularly fond of.

Rather than just exporting all your templates into a file, I think it is probably better to just include them in a post with the following format:

Abbreviation Description


Here are some of mine:


Seeing Jeffrey using variations of these to quickly create forms was what first made me realise how much time could be saved using templates. These are integrated to work well with the Twitter Bootstrap framework.

fo Form open tag

{!! Form::open() !!}

fc Form close tag

{!! Form::close() !!}

textfield Text form field

<!--- $VALUE$ Field --->
<div class="form-group">
    {!! Form::label('$NAME$', '$VALUE$:') !!}
    {!! Form::text('$NAME$', null, ['class' => 'form-control']) !!}

emailfield Email form field

<!--- $VALUE$ Field --->
<div class="form-group">
    {!! Form::label('$NAME$', '$VALUE$:') !!}
    {!! Form::email('$NAME$', null, ['class' => 'form-control']) !!}

passwordfield Password form field

<!--- $VALUE$ Field --->
<div class="form-group">
    {!! Form::label('$NAME$', '$VALUE$:') !!}
    {!! Form::password('$NAME$', ['class' => 'form-control']) !!}

textareafield Text area form field

<!--- $VALUE$ Field --->
<div class="form-group">
    {!! Form::label('$NAME$', '$VALUE$:') !!}
    {!! Form::textarea('$NAME$', null, ['class' => 'form-control']) !!}

hiddenfield Hidden form field

{!! Form::hidden('$NAME$', $VALUE$) !!}

submitfield Submit form field

<!--- $VALUE$ Field --->
<div class="form-group">
    {!! Form::submit('$NAME$', ['class' => 'btn btn-primary']) !!}

req Require field (add in the attribute array of any form field type to make field required.

'required' => 'required'


I've been playing with 5.0 for a few weeks now and so I've added a few route annotation templates. I'm sure more will be added over the coming months.

anno Add docblock ready for annotations below

* @return Response

@G Get route annotation

@Get("$ROUTE$", as="$NAME$")

@P Post route annotation

@Post("$ROUTE$", as="$NAME$")

@M Get route annotation


Blade Live Templates

I’ve been using these less since native blade support was added to PHPStorm but they are still useful.

@ex Blade extend


@fe Blade foreach

@foreach($GROUP$ as $INDIVIDUAL$)

@if Blade if


@ife Blade if/else



@inc Blade include


@sect Blade section


@yi Blade yield


bb {{ }} unescaped blade tags

{{ $CODE$ }}

bbb {!! !!} escaped blade tags

{!! $CODE$ !!}

view New view from layout




A few testing templates, I’m only just getting properly into test so I will be adding to these.

cci Codeception $I->


@test Test outline

/** @test */
public function it_$METHOD$()
    // Given
    // When
    // Then


I use these when I'm working on a throw away project and need to quickly import some basic styles and scripts.

bootcss Bootstrap css CDN link

<link rel="stylesheet" href="//"/>

bootjs Bootstrap js CDN link

<script src="//"></script>

jquery jQuery CDN link

<script src="//"></script>

lorem lorem ipsum generator

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Composer packages

I have a few packages that I add to every laravel install I do. Rather than have to remember the correct package number I just create a template to insert it into my composer file automatically (note: these are for Laravel 5).

gener Way/Generators

"way/generators": "~3.0",

illhtml Illuminate/Html

"illuminate/html": "~5.0",

reqdev Add require-dev to composer.json file

"require-dev": {


A few more that don’t quite fit into any category

lt Link to

{!! link_to('$PATH$', '$TEXT$') !!}

ltr Link to route

{!! link_to_route('$ROUTE$', '$TEXT$') !!}

errors Error loop

@foreach($errors->all() as $error)
    <li>{{ $error }}</li>

I have loads more but it's quite tiresome writing them, I'll add more a bit later today!

Please sign in or create an account to participate in this conversation.