Category Archives: PhpStorm

PhpStorm 8.0.3

I recently made the switch to PhpStorm from PhpED and I love it. So let me first say, there’s nothing inherently wrong with PhpEd, it’s a fairly solid editor, and it’s probably capable handling more than I am aware of. We used it at work, so that’s how I ended up using it. But recently, we have changed our development environment, and our team chose PhpStorm.

This turned out to be extremely helpful to me. And a big part of the reason for that is that Laracasts has 23 videos dedicated to PhpStorm. Also, just a side note, these videos are free to watch, so you don’t have to be a subscriber, though I wholeheartedly recommend subscrbing, especially if you are using Laravel.

Another side note, if you are using Yii 2, then check out DoingItEasy on Youtube. These are very helpful videos, especially if you are working through my book Yii 2 For Beginners.

So, getting back to PhpStorm and Laracasts. Until I watched the series of videos, I never really understood the true power of an IDE. And actually, I’m still just learning. But I thought it was important to share some thoughts because I had some unexpected benefits from using PhpStorm.

The first one probably has the biggest impact, which is creating a custom color theme. This doesn’t sound like something significant, but it turned out to be very significant for me.

For one thing, when I made the switch off of PhpEd, I had trouble with the default themes that ship with PhpStorm. Monokai and Darcula, two of the default themes seemed to be the most popular at work, so I tried them. I found the themes to be noisy, with eye-popping colors that interfered with my ability to read the code. It was awful.

I thought I might have to switch back to PhpEd, but that wasn’t really an option, since the team needs to be on the same editor. So I started searching around and I found Dayle Rees’s Color Schemes and reviewed all of those.

While there are a bunch of interesting themes there, I still felt disconnected from them. Another thing compounding the problem is that my eyesight is not that great and it doesn’t take much for me to suffer eye-fatigue. It’s a real problem.

Fortunately, because of Jeffery Way’s videos on Laracasts, I was able to learn how to customize the theme. So I literally spent 5 hours working on a single theme.

I certainly didn’t intend to spend that much time on it. When I looked up at the clock when I was done, I was amazed, because I just pushed through without a break. Crazy. On the other hand, it really paid off because I ended up with a theme that is pleasing to look at and helps me understand my code more quickly. That’s because the color associations are not just pretty, they have intent. The color of methods is related to Classes in just the right way for me, so I can easily understand the relationships. Parameters are distinguished from variables, etc. I found just the right balance of colors that give me hints, but not so much diversity that I can’t untangle the noise.

When I get around to it, I will probably post the settings file on GIT, to share it. But it probably won’t have the same effect for others as it does for me. That’s why customization is so important. You can find the theme most helpful to you by building it yourself. I would highly recommend doing this.

I would write instructions on how to do this, but really, the free videos are the way to go on that one.

Ok, a couple of other high points to mention. The live templates are just super cool. The way it works is you assign a string and action key to a custom template, so with a couple of keystrokes, you can inject a template into your code, a real time-saver.

For example, I use _c followed by pressing the tab key to create a new constructor. It doesn’t seem like much. It’s just a sight gain in efficiency from typing it out, but these slight gains are significant when you scale them out over time.

And of course the longer templates, form fields for example, are just a pleasure to work with. I type in textfield and hit tab and I have a form field waiting for me. You can also pop in the name of the field, and if you have set up the template properly, it will auto-populate the name into all the appropriate places in the form, such as label, fieldname, etc. This saves a lot of typing and time.

Programming time is precious. It’s like gold. Even the tiniest fragments have value. So any efficiency gain you get from your IDE is like putting money in your pocket.

One of the other features that has me really excited is the extract feature, where you can take a block of code and extract it to a separate method. I’m blown away at how well it works. This really helps clean up the code and make it more readable. And it’s so cool to see the choices the editor makes, you can learn from that as well.

PhpEd also has the extract function. Like I said, it’s not a bad editor. What it doesn’t have is 23 videos showing you all the cool things you can do with it.

There are a number of free editors as well, such as Netbeans and Eclipse, so if you are just starting out coding, you might want to try one of these first.

You can also customize your theme in Netbeans, not sure about Eclipse. PhpStorm just seems more robust. The only downside is the cost, but for me it’s worth it because I’m going to be spending a lot of time in my IDE and I need to be as comfortable and as efficient as possible.

A lot of pros also prefer Sublime, but I have no experience with that one, so I can’t really comment on it.

I’ll probably look into Sublime in the future, but for now, I still have a long way to go with PhpStorm for now.

Learning and mastering your IDE, setting up and memorizing all your short-cut keys, templates, color schemes, etc., can take years. But don’t let that intimidate you or cause you to put off learning it. Every little bit helps, even if you start slowly. And if you are like me, you will see dramatic improvements in your work flow as you become more comfortable with it, even when you are new to it like I am.

Advertisements