Development with Drupal can be very challenging even for advance PHP coders. However, we will not give up! Drupal is pushed forward by a large community who love and work to improve it every day. The fact is the more you work with Drupal the more your love will grow beyond any hate for it. In every web development area, the tools you use affect the experience you get and developing with Drupal is no exception. Take the case of Notepad and Notepad ++, I guess now you how much the correct tools can save you from nightmares.
In this article, we look at 4 tools that did not only make our Drupal development better but also made it faster and easier. With these tools, you will see your productivity increase in no time. If you’re a serious Drupal user without using this tools then sit tight and keep reading cause you’ve been missing out a lot. In case you have been using these tools then please care to share your experience with them.
Listed here are the 4 tools a use to quickly and effectively develop all our projects. This is just a resume of each and you will have to try it out yourself to experience their full power.
Devel and Search Krumo modules
When it comes to debugging code, Devel is one of the most used Drupal development module. It is also used to generate content and all sorts of dev tasks. Search Krumo on the other hand is another awesome module that when added to it gives you the power to navigate through large arrays structures which we often come across especially in Drupal 7.
These tools are probably your first step in debugging variables in Drupal. With the use of Devel's dsm(), dpm(), and krumo() functions in your code you can print out arrays, objects and whatever you need for a great overview. Plus, the functions mentioned above are not all there is to it…
Devel module is also greatly used in content generation. You can use the various submodules available to generate nodes, taxonomy terms, user and much more. This is very useful in cases where you might need a lot of nodes to test something out. Also, it can be used to execute PHP codes in the Drupal environment, switch between users on the site and other very useful functionality which are a must have when developing.
A good IDE
The days of coding with Notepad are way behinds us now with IDEs being most suitable for the job. We personally use PHPStorm and JS, which I find of very great help.
We all know what an IDE can do for you; speed up your development time by preventing code mistakes, highlighting syntax for great readability, code hinting for classes and functions in your project and many others. All of these are of very great use since Drupal 7 is of the most part procedural, you will need to be aware of many functions and parameters. An IDE saves you from wasting time searching for APIs.
One of the most important uses of IDEs is debugging. Integrating PHPStorm with XDebug on my local server really changed things around.
Speeding up most of your tasks with a command line tool like Drush is very practical.
Its nick name “Drupal’s Swiss Army knife” really suites it well. Since Drupal allows you to perform a host of Drupal tasks from the command line. You are able to download and enable/disable/uninstall/update modules or Drupal core and all sorts of other helpful tasks. Here is a list of core commands for you to get an overview of what you can do with this tool.
Another great functionality Drush provides apart from all the awesome core commands you’ve seen above, is the ability to declare yours. This way you can bring your custom functionalities to the command line. It is very versatile so you are not limited. It can be use to create jobs for Cron and even carry out maintenance.
Although Devel is a great tool for printing out variables, it has nothing on Xdebug in terms of debugging. When done with the setup, all there is to do is to place a breakpoint in your code and load your site page. The execution stops at the breakpoint (that was hopefully supposed to be executed) and give you access to a bank of contextual information. You get all the global and scope variables that you can navigate through, a great callstack of what functions or methods have been triggered so far and many others.
Additionally, you can also decide to execute your code line by line and jump inside of to be called functions to see where the code is going. This is a great way to debug when your code fails. It will help you answer questions like; at which point does that exception get thrown or why is that variable null? We highly recommend you check this tool out.
There you go! Four tools that will change the way you develop with Drupal. Drush and the Devel module are exclusively Drupal tools but a good IDE and XDebug is applicable to any PHP project. We can guarantee you that all the tools mentioned above are worth taking a look.
Looking for Drupal Experts? We have those! We’d love to talk more about your project.