Common PhpStorm Settings to make your development FLY!
Switch branches/tags
Nothing to show
Clone or download
weaverryan Merge pull request #20 from Pierstoval/patch-1
Update Doctrine column template
Latest commit b35255c Aug 6, 2018

PhpStorm Live Templates (+ other settings)

This repository includes live templates for PhpStorm (and may contain other settings in the future).

Share your Favorite Settings! This isn't meant to be a readonly repository. Have something you love about your PhpStorm setup? Create a pull request and share it.

See the Live Templates


Before you do this, make sure PhpStorm is not running, or it will overwrite the changed files before shutting down.

Your installation of PhpStorm has various directories and configuration files. By putting some configuration files from this repository into the right place, you'll be able to get new features, like live templates.

Find your config folder

For PhpStorm starting from 2016.1, replace 'YYYY.X' with the version number of PhpStorm.

OS Location
Windows XP C:\Documents and Settings\<User name>\.PhpStormYYYY.X\config
Windows Vista C:\Users\<User name>\.PhpStormYYYY.X\config
Linux ~/.PhpStormYYYY.X/config
OS X ~/Library/Preferences/PhpStormYYYY.X

ℹ️ Note: Sometimes, with newer versions of PHPStorm and Windows, you might have to change the directory for C:\Users\{Your user name}\.PhpStormYYYY.X\config\jba_config\templates instead.

🔄 If you are using the Settings repository feature, the directory you have to upload your templates to is different too:
C:\Users\<User name>\.PhpStormYYYY.X\config\settingsRepository\repository\templates.

For PhpStorm before 2016.1, replace 'XX' with the version number of PhpStorm: WebIde80 for PhpStorm 8, WebIde90 for PhpStorm 9, etc.

OS Location
Windows XP C:\Documents and Settings\<User name>\.WebIdeXX\config
Windows Vista C:\Users\<User name>\.WebIdeXX\config
Linux ~/.WebIdeXX/config
OS X ~/Library/Preferences/WebIdeXX

See Directories used by the IDE to store settings, caches, plugins and logs for more information about the configuration directory structure.

Download the files you want

Inside your config folder, you'll see a number of directories:

Directory Contents
codestyles Code Style settings (Editor > Code Style)
colors Colors & Fonts settings (Editor > Colors & Fonts)
fileTemplates File and Code Templates (Editor > File and Code Templates)
filetypes File Types (Editor > File Types)
inspection Inspection profiles (Editor > Inspections)
keymaps Keyboard shortcuts (Appearance & Behavior > Keymap)
templates Live templates (Editor > Live Templates)

Suppose you want the Symfony live templates from this repository - which are located at templates/knp_symfony.xml. Follow these steps:

  1. Download that file - you can clone the whole repository, or just download that one file.

  2. Move the file into the templates/ subdirectory of your config folder

  3. Start PhpStorm (because of course, you closed it before trying all of this... didn't you???)

That's it! In the PhpStorm Settings, under "Editor > Live Templates", you should see the new "symfony" live templates.

Live Templates

Frontend Templates


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.

Symfony Templates


Adds controller form-handling code

$form = $this->createForm($CLASSNAME$::class);

if ($form->isSubmitted() && $form->isValid()) {
    // todo - do some work, like saving stuff

    $this->addFlash('success', '$SUCCESSMESSAGE$');

    return $this->redirectToRoute('$ROUTENAME$', []);


{{ form_row(form.$FIELD$) }}


Renders widget/label/errors

<div class="form-control">
    {{ form_label(form.$FIELD$) }}
    {{ form_widget(form.$FIELD$) }}
    {{ form_errors(form.$FIELD$) }}


Queries from a doctrine repository in a controller



Renders a Twig template from a controller

return $this->render('$TEMPLATE$', [


404 if statement for your controller

if ($CONDITION$) {
    throw $this->createNotFoundException($MESSAGE$);


{{ include('$TEMPLATE$') }}




{{ path('$ROUTE$', { $END$ }) }}


{{ render(controller('$CONTROLLER$', { $END$ })) }}


@Route("/$PATH$", name="$NAME$")


Creates a controller action.

 * @Route("/$PATH$", name="$ROUTE_NAME$")
public function $NAME$Action()


Creates a YML service

    class: $CLASS$
        - '$ARG1$'


Yaml service tags

    - { name: $TAGNAME$ }


Query objects in repositories with DQL

    ->createQuery('SELECT $ALIAS$
                   FROM $ENTITY$ $ALIAS$
                   WHERE $ALIAS$.$PROPERTY$ = :$PARAMETER$')
    ->setParameter('$PARAMETER$', $ARGUMENT$)


$em = $this->getDoctrine()->getManager();




Adds a property with @ORM annotations

 * @ORM\Column(type="$TYPE$")
private $$$PROPERTYNAME$;


{{ asset('$PATH$') }}


{% javascripts
    <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}


{% stylesheets
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}


Generates an XML services file

<?xml version="1.0" ?>

<container xmlns=""

        <service id="$SERVICEID$" class="$CLASS$" />


YAML route

    path:   /$PATH$
    defaults:  { _controller: $CONTROLLER$ }


Query objects in repositories using query builder

            ->where('$ALIAS$.$PROPERTY$ = :$PARAMETER$')
            ->setParameter('$PARAMETER$', $ARGUMENT$)


Allows fast entering of translated messages

{{ '$MESSAGE$'|trans }}


Creates a XML service

<service id="$NAME$" class="$CLASS$">
    <argument type="service" id="$ARG1$"/>


First, a thanks to nicwortel for this repository, which contains some nice settings (including stuff that we don't have here). He also did a really nice job with his README, and I've borrowed parts of it shamelessly.

A number of people have contributed to this repository. Additionally, some templates were adapted from