themetman's picture

I was using PhpStorm in Drupal 7/8, is there a Plugin (I have looked and cannot find one), or is there a trick to make it work with Backdrop.

Otherwise any recommendations on a good IDE for module development/debugging?

Thanks in advance.

Accepted answer

I use vim because it is lightweight and gets the job done.

you can integreate with xdebug/vdebug

 

PHPStorm is great, but i find it takes a lot of system resources.

 

Honorable mention to:

  • atom

 

As @stpaultim said using the Drupal7 plugin for either PHPStorm or Atom will get you a long way.

Most helpful answers

Hello Brad.

One instance of when I like to use git from vim is :Gread to checkout a file that i currently have open in the editor. Here is a quick vid I made to illustrate when/where this is helpful.

https://youtu.be/QXQqfb4GwO8

Here is my init.vim file for neovim that I use to work on code every day.

https://github.com/serundeputy/gffNeovim/blob/master/gff.init.vim

Hope that helps!

~Geoff

Thanks @serundeputy, nice to hear what other people value in/about a program.

For me, I used a basic text editor for a long time. Linux comes with gedit/xed which I liked because of its features like: line numbers, syntax highlighting, auto indentation, etc. I used Linux's default file manager to connect via SSH to my server, then I'd open files to edit in my editor (while running git commands, etc. in my ternimal via SSH).

Eventually though I got sick of this method. The SSH file manager was often slow, and so I decided to take the plunge into an IDE. After searching around and trying different ones, I settled on Atom. My main requirement (apart from needing to be open source) was the ability to SSH to my server and show/edit files through the IDE. While Atom doesn't support this out-of-the-box, there's a popular package (a.k.a. module) that provides this feature. Also, it's made by GitHub, and Backdrop's on GitHub so that's nice :-) (ironically I don't use it's built-in GitHub integration, preferring instead to run all git commands in a separate terminal still).

I have used NetBeans for a long time: https://netbeans.apache.org/ (even before Oracle bought Sun)

Since Oracle handed it off to Apache to take over, there have been some bumpy transitions, and I had to use some older plugins to get functionality I was used to, but it currently working well for me.

The reason I have stayed with NetBeans is because I can have multiple instances of the application running, each with multiple different projects open, each with multiple different files open. I don't do that often, but when I do, it's nice to have that ability, and I haven't found any other IDE that offers that.

There is a Drupal 7 plugin for NetBeans, which I have installed and use occasionally (mostly for linking code to the API site), but it has not been maintained in a long time, so using it for generating skeleton modules and it's other functionality might not work.

I also sometimes I use Nano for quick "fixes."

When I tried Atom a few years ago, I did not care for it, because it required me to modify the UI by finding and modifying CSS.

Comments

I use either Sublime Text or PHPStorm for my Backdrop work, but I am not a power user of either tool and don't have any special debugging tools enabled. I think that Backdrop benefits from the Drupal configuration for PHPStorm somewhat, but I don't think there is any custom support for Backdrop in PHPStorm. 

I'll be curious what others have to say. 

I use vim because it is lightweight and gets the job done.

you can integreate with xdebug/vdebug

 

PHPStorm is great, but i find it takes a lot of system resources.

 

Honorable mention to:

  • atom

 

As @stpaultim said using the Drupal7 plugin for either PHPStorm or Atom will get you a long way.

BWPanda's picture

I like Atom.

@serundeputy is a true geek ;-)

There's a Drupal plugin for Atom...?

klonos's picture

I'm like @stpaultim (I don't consider myself a power-user/dev) ...I mainly use Sublime Text, but also have PHP Storm installed.

oadaeh's picture

I have used NetBeans for a long time: https://netbeans.apache.org/ (even before Oracle bought Sun)

Since Oracle handed it off to Apache to take over, there have been some bumpy transitions, and I had to use some older plugins to get functionality I was used to, but it currently working well for me.

The reason I have stayed with NetBeans is because I can have multiple instances of the application running, each with multiple different projects open, each with multiple different files open. I don't do that often, but when I do, it's nice to have that ability, and I haven't found any other IDE that offers that.

There is a Drupal 7 plugin for NetBeans, which I have installed and use occasionally (mostly for linking code to the API site), but it has not been maintained in a long time, so using it for generating skeleton modules and it's other functionality might not work.

I also sometimes I use Nano for quick "fixes."

When I tried Atom a few years ago, I did not care for it, because it required me to modify the UI by finding and modifying CSS.

Really guys? None of you Visual Studio Code!!

If dont have anything against Microsoft, then you should try it

themetman's picture

Thank you all for your comments. Just goes to show how lucky we are to have so much choice.

@proteas I am  a Linux man myself (a Gentoo fan), so am familiar with Vim, @serundeputy, but never tried it for this sort of thing, using Netbeans, PyCharm and PhpStorm mainly. I might give Vim it a go though as well as Sublime Text to see which works for me.

Alll the answers above have been useful.

Hello @themetman

Of course I agree with you, the best tool is what you know best :)

I am WP dev and for me the best tool is phpstorm, but there is a lot of fuss for Visual Studio Code, is a trend these days.

I use visual Code only for simple edits

klonos's picture

Most of my coworkers have been using PHPStorm (we have a company licence for it), but many have recently switched to Visual Studio Code too.

BWPanda's picture

A question for those who've answered so far: why do you use what you use? Why choose it over, say, a plain text editor? And since we're an open source community, for those who use proprietary software, what is it about it that you like over open source alternatives?

Just curious to know... :-)

`vim` is lightweight and doesn't need to use my cup fan (PHPStorm and Atom (with many plugins) have at times taken so many system resources that the computer crashes).

PHPStorm is not open source, but they do contribute their fair share to open source and there is an open source IDE framework that jetbrains makes/uses that you could leverage as an open source version (too much work/overhead for me)

In `vim` i have `Vdebug/Xdebug` set up nicely; that is possible w/ all the other editors too, but since mine is working like a charm i'm happy where I am.

`vim` is available everywhere i go

  • different dev computer
  • server
  • etc

`vim` is always there and is my friend.

There are many users of vim, documentation, and everything i've ever wanted or needed to has been done and documented somewhere. (til; GitFugitve, where I can do git things from right inside vim).

 

At the end of the day `vim` is where i am comfortable and productive.

I'm curious what you like about doing things like running git commands inside vim. Is it to minimize the number of windows?

If you have links at hand for the vdebug/xdebug integration that sounds pretty useful. I've used vim for a long time but the fanciest I get, typically, is split screen editing of more than one file.

BWPanda's picture

Thanks @serundeputy, nice to hear what other people value in/about a program.

For me, I used a basic text editor for a long time. Linux comes with gedit/xed which I liked because of its features like: line numbers, syntax highlighting, auto indentation, etc. I used Linux's default file manager to connect via SSH to my server, then I'd open files to edit in my editor (while running git commands, etc. in my ternimal via SSH).

Eventually though I got sick of this method. The SSH file manager was often slow, and so I decided to take the plunge into an IDE. After searching around and trying different ones, I settled on Atom. My main requirement (apart from needing to be open source) was the ability to SSH to my server and show/edit files through the IDE. While Atom doesn't support this out-of-the-box, there's a popular package (a.k.a. module) that provides this feature. Also, it's made by GitHub, and Backdrop's on GitHub so that's nice :-) (ironically I don't use it's built-in GitHub integration, preferring instead to run all git commands in a separate terminal still).

KWrite

Because I've been using it for 20 years?

I primarily use tools for developing that were recommended to me by folks when I was getting started. Or in the case of PHPStorm, that are recommended to me every time https://www.drupal.org/u/cosmicdreams walks into the room. (You can't help but be influenced by people who support a tool as enthusiastically as Chris does). 

I also gravitate towards tools used by the people who I most frequently reach out to for support and this leads me to PHPStorm as well. If the people who are helping me use the tool, it's easier for them to advise me and easier for me to receive their advice. 

I don't do enough hard core development to spend a lot of time evaluating IDEs. But, as PHPStorm has some really powerful features that make my life easier at times, I haven't had sufficient reason to look further. 

I don't develop for Drupal or Backdrop these days. I do write PHP code but with Yii. My IDE of choice is PhpStorm. It's not free, it's somewhat heavy on resources (written in Java...), but it's very powerful. It costs (not too much though, I wouldn't call it expensive), it's heavily developed and supported (at least 3 .x versions each year) and it's been my favorite IDE for a long time now.

I don't use any special settings but I use the following extensions that may be relevant:

- Drupal Syntax Highlighting

- phpcs (with the Backdrop CMS phpcs standard)

I'm not sure how well documentation will work as every environment is different. While I use VSCode in Windows 10, the code it is working on is in WSL2 Ubuntu environment and inside that environment within a lando container. That's going to be very different from VSCode and WAMP 

I have setup VSCode with the typical configuration settings used by drupal: 2 spaces instead of tabs, no trailing spaces, blank line at end of file.

I have also added extensions: Drupal Syntax Highlighting, phpcs, & phpcbf.

I am wondering how did you setup phpcs (with the Backdrop CMS phpcs standard)?

Thank you.

Yes, you want to use the Backdrop PHPCS standard. You can get it here:

https://github.com/backdrop-ops/phpcs

Please note that this is not yet a full implementation of the Backdrop CMS PHP standard and that it doesn't include JS, so do look at:

https://docs.backdropcms.org/documentation/coding-and-documentation-stan...

and 

https://docs.backdropcms.org/documentation/developing-modules

The docs site is usually your friend when you're unsure about something.

@yorkshirepudding Thank you for the links and details on the Backdrop phpcs standards. This is part of what I was looking for.

This is great I now have the Backdrop coding standards working with VSCode on my setup and anytime I open a file right away I can see if there are coding errors and with the console window open details of what they are. Makes it easier to learn what the backdrop coding standards are.

To check a module do you need to go through each file or is there a batch method to identify all files with errors and then set about fixing them?

To answer my own question

To check a module do you need to go through each file or is there a batch method to identify all files with errors and then set about fixing them?

I think this involves working through the command line, outside of VSCode. I don't think it can be done within VSCode, but I may be wrong.

Drawing on some information from Drupal pages and squizlabs I have started to configure my setup to work with the command line and VSCode. It should then be possible to use `phpcbf` to do some automatic fixing with the command line.

https://www.drupal.org/docs/contributed-modules/code-review-module/php-c...

https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage

Now, I also have xdebug working with VSCode.

In the zulipchat discussion, https://backdrop.zulipchat.com/#narrow/stream/218635-Backdrop/topic/Back... there is an answer to the question about two sets of sniffs:

The new phpcs rulesets on https://github.com/backdrop-ops/phpcs works with the latest version of PHP_CodeSniffer, while the outdated one that ships with coder_review is completely incompatible.

The new version required to start from scratch, so "combining" these two libs isn't possible.