• Stars
    star
    173
  • Rank 219,460 (Top 5 %)
  • Language
  • Created about 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Common PhpStorm Settings to make your development FLY!

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

Installation

  1. Go to PhpStorm Preferences | Tools | Settings Repository

  2. Add Read-only Source https://github.com/knpuniversity/phpstorm-settings

  3. Restart PhpStorm

You can see and manage all the snippets under the Preferences | Editor | Live Templates

Live Templates

Frontend Templates

lorem

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

formhandle

Adds controller form-handling code

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

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

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

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

formrow

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

formrowfull

Renders widget/label/errors

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

repofind

Queries from a doctrine repository in a controller

$this->getDoctrine()
    ->getRepository('$REPO$')->$METHOD$($ARG$);

rendertwig

Renders a Twig template from a controller

return $this->render('$TEMPLATE$', [
    $END$
]);

404unless

404 if statement for your controller

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

include

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

method

@Method("$METHOD$")

path

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

render

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

route

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

action

Creates a controller action.

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

service

Creates a YML service

$NAME$:
    class: $CLASS$
    arguments:
        - '$ARG1$'

tags

Yaml service tags

tags:
    - { name: $TAGNAME$ }

createquery

Query objects in repositories with DQL

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

getem

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

getrepo

$em->getRepository('$ENTITY$');

doctrinecolumn

Adds a property with @ORM annotations

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

asset

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

asseticjs

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

asseticcss

{% stylesheets
    '$PATH$'$END$
    filter='cssrewrite'
%}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

xmlservices

Generates an XML services file

<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

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

yamlroute

YAML route

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

querybuilder

Query objects in repositories using query builder

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

trans

Allows fast entering of translated messages

{{ '$MESSAGE$'|trans }}

servix

Creates a XML service

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

Credits

First, a thanks to nicwortel for this https://github.com/nicwortel/phpstorm-ide-config 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 https://github.com/raulfraile/sublime-symfony2.

More Repositories

1

oauth2-client-bundle

Easily talk to an OAuth2 server for social functionality in Symfony
PHP
726
star
2

KnpUGuard

Simple and lovely Symfony authentication
PHP
100
star
3

symfony4

Screencast code, script and tandem bikes behind the "Stellar Development with Symfony 4" tutorial
Twig
79
star
4

symfonycon-frontend

Example Project for "Cool like Frontend Developer: Grunt, RequireJS, Bower and other Tools" from SymfonyCon 2013!
PHP
77
star
5

rest

Screencast code, script and HTTP Methods for "RESTful APIs in the Real World Episode 1"
CSS
53
star
6

symfony

Screencast code, script and kittens behind the "Joyful Development with Symfony 3" Tutorial
CSS
46
star
7

KnpUGuardBundle

Simple and lovely Symfony authentication
PHP
45
star
8

oauth

Screencast code, script and chicken drawings for the OAuth course
PHP
39
star
9

symfony2-rest

Screencast code, script and a 417 status code for our REST with Symfony tutorial
CSS
21
star
10

guard-presentation

Code behind the Guard presentation first given at Symfony Live San Fran in 2015
PHP
19
star
11

guard-tutorial

Tutorial for the Guard Auth library
PHP
16
star
12

symfony2-series

Screencast code, script and ponies for "Starting in Symfony 2" track
CSS
15
star
13

ansible

Course code, script and tons of really-cool-YAML-that-builds-servers for our "Ansible for Automation" tutorial
PHP
15
star
14

javascript

Screencast code, script and all the AJAX you can eat for the modern JavaScript Tutorials on KnpUniversity
PHP
14
star
15

behat

Screencast code, script and kittens behind "BDD, Behat, Mink and other Wonderful Things Tutorial"
PHP
12
star
16

php-beginner-series

Screencast code, script and lasting friendship for episode 1 of the upcoming PHP series
PHP
11
star
17

webpack-encore-bundle

Symfony Integration with WebpackEncore
PHP
10
star
18

symfony-bundle

Screencast code, script and birthday presents behind the "Creating a Reusable (& Amazing) Symfony Bundle" tutorial
PHP
10
star
19

twig

Screencast code, script and Twiggy goodness for "Twig Templating for Friendly Frontend Devs"
PHP
10
star
20

doctrine-queries

SQL, DQL, Query Builders and code for the "Query Like a Pro in Doctrine" series
PHP
9
star
21

whats-new-symfony3

Screencast code, industry secrets, and all things "3" for the "What's new in Symfony3 tutorial"
PHP
9
star
22

gulp

Screencast code, script and minified CSS files for our Gulp! Screencast
PHP
9
star
23

lorem-ipsum-bundle

Rainbows, unicorns, sunshine, friendship & other things you want in your lorem ipsum text!
PHP
8
star
24

phpunit

Screencast code, script and kittens behind the "PHPUnit: Testing with a Bite" tutorial
PHP
8
star
25

symfony-journey

Journey to the Center of Symfony: Code and Script
PHP
7
star
26

drupal-under-the-hood

Screencast code, script and Drupal nodes behind "Drupal 8: Under the Hood"
PHP
7
star
27

oo

Screencast code, script and spare parts for classes (e.g. extra interfaces, refurbished class constants, etc) for the intro OO course
PHP
5
star
28

FOSUserBundle

Screencast code, script and friendly robots behind "FOSUserBundle (FTW!)" http://knpuniversity.com/screencast/fosuserbundle-ftw
PHP
5
star
29

easyadminbundle

Screencast code, script and random compliments behind the "EasyAdminBundle: Simply Amazing Admin Interfaces" tutorial
PHP
5
star
30

symfony-guard-demo

A demo application showing KnpUGuardBundle in action
PHP
4
star
31

activity-runner

Executes Twig and PHP activities in a safe manner
PHP
4
star
32

dependency-injection

Screencast code, script and rainbows behind "Dependency Injection and the art of services and containers"
PHP
4
star
33

symfony3-upgrade

Screencast code, script and Symfony 3 Magic behind "Upgrading to Symfony 2.8 & 3.0!"
PHP
4
star
34

design-patterns

Course code, script and SCARY, I mean friendly, design patterns behind the "Design Patterns in Space" Tutorial
3
star
35

stripe

This repository + KnpUniversity Tutorial + ??? = PROFIT!
PHP
3
star
36

rest-ep2

Screencast code, script and HATEOAS for the upcoming REST episode 2 course
CSS
3
star
37

blog

The Blerg! Ahem, Blog! The content source of the SymfonyCasts blog
3
star
38

php7

Screencast code, script and sunshine behind the "PHP 7: The Important Stuff" tutorial
PHP
3
star
39

phpstorm

Lean and Mean Dev with PhpStorm (for Symfony)
PHP
2
star
40

symfony-best-practices

PHP
2
star
41

twig-challenges

Challenges for the Twig Tutorial
PHP
2
star
42

dcon2016-workshop

nothing to see here... move along now...
PHP
2
star
43

micro-symfony

2
star
44

sunshinephp-behat

Starting project for SunshinePHP 2014 Behat Workship
PHP
2
star
45

composer

Screencast code, script and magic for "The Wonderful World of Composer Tutorial"
PHP
2
star
46

symfony2-ep4

Screencast code, script and smiles for "Starting in Symfony2: Episode 4"
PHP
2
star
47

symfony2-ep3

Screencast code, script and sunny days for "Starting in Symfony2: Episode 3"
CSS
1
star
48

oo-challenges

Challenges for the OOP Series
1
star
49

symfony2-ep2

Screencast code, script and ice cream for "Starting in Symfony2: Episode 2"
PHP
1
star
50

symfony-alice-fixtures

Lesson about Using Alice and Faker for Fixtures in Symfony
PHP
1
star
51

contributing

Screencast code, script and rainbows behind the "Contributing back to Symfony!" tutorial
1
star
52

GittyUp

Simple (and really internal) library to help with git tasks
PHP
1
star
53

symfony-voters

Fireside chats with warm cookies and Symfony voters
PHP
1
star
54

behat-challenges

Challenges for the Behat tutorial
PHP
1
star