I develop a lot in PHP, and I use NetBeans for my projects. However, I heard many good things about PhpStorm, so I did try a free trial.
In this article, I’m comparing NetBeans 12.5/6 with PhpStorm 2021.2/3, which were the newest versions at the time I used them.
This is not a thorough comparison, IDEs are huge, it’s impossible to cover everything, so I will just cover the things that stood out to me.
New Lines at End of File
You probably know this feel, you commit something to Git, push to GitHub, and see a little forbidden sign at the end because you forgot a new line at the end of the file.
Well, PhpStorm can help you there! There’s a setting to add a new line at the end of the file *if* there isn’t already one. But it gets better, it can also trim multiple newlines at the end of the file, to ensure there’s only one.
With NetBeans, I had no luck finding such a setting. I even tried manual formatting in Preferences > Editor > Formatting > Language PHP > Blank Lines. But there is no field for “before EOF (end of file)”. I only found a setting to remove “trailing whitespace”, which is not what I want, or rather, is not the right setting here.
Speaking of Git, both IDEs have basic Git support. For the full / real Git experience, though, I recommend either to use the plain CLI Git, or some dedicated Git GUI.
Of course, to use the Git CLI, you need a Terminal. Both IDEs provide a built-in Terminal. However, I think PhpStorm handles this better:
In NetBeans, you have to go to Window > IDE Tools > Terminal, which is kind of hidden and inconvenient if you need to go there often.
In PhpStorm, the Terminal is a tab in the bottom, which is much easier to access. Furthermore, PhpStorm automatically cd’s to your project dir, whereas NetBeans just starts the terminal in your home dir, and you have to manually cd to your project dir.
Also, NetBeans seems to not properly load the PATH. When I start the terminal, I get an error message that “gpgconf” is not found, which is what I run to start the GPG agent for SSH.
PhpStorm supports many formatting templates, to automatically (re)format your code. This includes PSR-12, *the* formatting standard for PHP.
With NetBeans, you get no templates. There’s a default formatting configuration, and you have to manually change it if you want PSR-12, which is much more work than you might think.
It’s hard to imagine that NetBeans did not add PSR-12 as template, but then again, NetBeans is not just a PHP IDE, and it’s probably not their focus. Also, it’s free, and you get what you paid for. (:
Both IDE’s support reading the composer files. If my project uses Smarty, NetBeans will automatically detect this from Composer and ask if I want to enable Smarty support.
But PhpStorm also supports syncing project settings with Composer settings, this means if I specify the PHP version in Composer, PhpStorm can automatically set the PHP version of the project to that version, which NetBeans cannot.
Both IDEs support MySQL (also works with MariaDB) so that you can connect to your DB, see the structure, see the data, run queries, create/alter tables in a GUI, etc.
But PhpStorm does two more things: 1. It detects SQL in PHP strings, and highlights them and 2. It helps you to autocomplete the SQL you’re writing within PHP (by knowing the DB structure from the before mentioned connection).
One thing to note is, I did initially not even know NetBeans supports MySQL (MariaDB)… I used phpMyAdmin for local development. I knew that PhpStorm supports it because it told me so as soon as it saw SQL code. But NetBeans didn’t ever tell me.
Of course there are many features I did not cover, but the ones I did cover, are features I use every day, and where the lack of sub-features by NetBeans are noticeable the most.
Overall, PhpStorm is the nicer/smoother experience. But the downside is that it’s paid. I’m not yet sure if the move to PhpStorm is worth it. NetBeans is FOSS, whereas PhpStorm is not. I don’t mind that PhpStorm isn’t FOSS, but I know some would mind. If it was free (not paid), I’d switch in a heartbeat. But since it’s just for personal use, and I’m not making money with my personal projects, I’ll probably stick with NetBeans.
If I was a business user, making good money with my PHP projects, I’d buy PhpStorm to make my life easier.
PS PhpStorm provides free licenses to FOSS developers, assuming it’s an active project with an approved Open-Source license. The downside is, the license is then really only for FOSS use, and not for personal/proprietary projects. I probably could get myself a free FOSS license, but