Whether you are writing PHP code or styling a website with cascading style sheets (CSS), there are a range of tools which can make your life much easier and allow you to focus on writing good quality code quickly and efficiently. This "practical development" series of articles will focus on using PhpStorm as a development environment and will consider seven topics.
There is more than one way to do it *
I am not saying that what I suggest in these articles is the best – or only – way to work. I'm writing from my own experience of how I am currently working and how we are doing it at work. The information is trial tested on windows environment but shall be documented as OS agnostic as possible. The practices should be applicable to either windows, Linux or mac.
You can pick and choose the practices that suit you and I would welcome any suggestions for other IDE's or platforms which you find useful.
Each of the topics will highlight one aspect of software development as described below, and will form a separate article each month in the Joomla Community Magazine (JCM).
Setting up your working environment and tools
Define a (directory) structure, with "project directories" that allows for multiple projects / sites in your workflow. A project directory will be the central location for all data related to a project, making it easy to archive projects or transfer to a different system.
Make use of (soft-)linking (also on windows!) of files and directories, making making files from outside the "project directory" available within that "project directory". A link basically provides multiple locations to access the same file.
Manage and publish your files, apply coding and style
CSS and using CSS with preprocessors
Styling a website using CSS is a basic principle of website design. While CSS is powerful,it has come a long way since it was first introduced. Techniques have been borrowed from other programming languages to advance what CSS is capable of. Over the past years, we have seen the development of 'pre-processors' such as 'Syntactically Awesome Style Sheets' (SASS) and 'Leaner CSS' (LESS). Each have their own strengths and weaknesses which are evolving - and each output standardised CSS. To keep up with the ever-evolving functionality of the preprocessors you should not rely on support built into templates but use your IDE to do the preprocessing.
See what is going on in the code
The effort and improvement of Joomla! documentation over the last years has been epic!
Stop execution at specific points in the code, inspect variables and modify them, all without modifying the source. Setting it up for local and remote use is well worth the effort.
Manage changes, roll back, contribute
A version or Revision control system (VCS) has been the friend of professional software development for decades. The tools you could choose from including, CVS, Subversion, GIT have changed over time. At this moment probably the most commonly used VCS in the Open Source world (and the system used by the Joomla! project) is GIT. An IDE can support you in the basic tasks of the VCS, creating branches for issues or added functionality and saving (intermediate) annotated changes. You can even use it to contribute to Joomla! testing and bug fixing.
Installable archives, miscellaneous tasks
When developing your own extension (or package) in end the you need to create a archive that you can install to your site or submit to the Joomla! Extensions Directory (JED). Using building tools like make, ANT or PHING will help with these repetitious tasks. PHING is the PHP extensible version of ANT and as it is natively supported by PhpStorm makes it the natural choice for building archive, running test and validations and any other project specific tasks.
Unit testing, automated testing, user interface (UI) testing
"Everybody" talks about it but only a few manage to do it. There is a strong push and a good reason to adopt automatic testing. The concept of having automated tests seems obvious, how to actually implement and deploy these within your projects is a different thing, especially with UI interaction. I still need to wrap our head around that, and that's why we kept it for last ;)
We intend to document all the above topics and share them in forthcoming issues of the Joomla! Community Magazine. If you have any comments or suggestions for topics to cover please get in touch via the bio below. Share and enjoy (thhgttg)
By accepting you will be accessing a service provided by a third-party external to https://magazine.joomla.org/