Book Review - Developing Extensions for Joomla! 5 by Carlos M. Cámara Mora
I became aware of the changes in extension development in Joomla when I started looking at migrating websites from Joomla 3 to Joomla 4. A sticking point for me was that some extensions hadn't been made Joomla 4 compatible. Some took a long time to be updated and some didn’t ever work in Joomla 4. It was a big jump and reading this book I can now see much more of what that was about.
The Preface to the book states: “This book is for Joomla! users and web designers who want to extend the functionalities of Joomla!...” but the Amazon blurb updates this to replace “users” with “developers”. The author quite fairly makes assumptions about the experience of its readers. It would be a far longer read if it covered all aspects of coding with PHP, what Model-View-Controller does (and means), and why we need to use Joomla services in our development, but can’t explain everything, so having useful links to further reading after every chapter is very helpful. I would however like to one day find an easy-to-understand reference guide to Joomla services such as RouterFactory and ComponentFactory.
When I started reading this book, my goal was to achieve a better understanding of how plugins work, but once I’d read the contents, I also wanted to dive straight into the section on Web Services, creating forms that work with extensions and much more. At this point, Brian Teeman’s foreword helped reign in my enthusiasm and I sat away from my computer reading a PDF copy of the book on my iPad.
My experience of extension development admittedly began sometime in the past (around Joomla 2.5), and while I get involved in coding it’s mostly of the overrides variety. It’s possible to get a good way to make a module by copying an existing one and applying necessary changes to namespaces, functions, and the display layer, but approaching a project with no existing code is a much larger task. Luckily there are downloadable code examples available and as this is a working extension, changing names, database fields and parameters is quite easy, saving writing every line of code from scratch.
Parts 1 & 2 cover the case study of building a component, from planning, coding, and installation to extending functionality with forms, Web Services, modules, and plugins.
Part 3 is a helpful discussion about creating templates in Joomla and how child templates. There are, after all, five types of extensions, and a template is one of those types.
We all know about testing, and mostly how important it is to do some to ensure the website, extension, and package do what they should, but sometimes that’s just making sure no errors occur when loading a page. Chapter 12 leads us into the “why” and “how” of testing. It’s towards the end of the book but it’s the closest I got to stopping reading and checking out CodeCeption straight away. The reading list is also quite comprehensive.
Doing it the right way
The way extensions are constructed in Joomla 5 has changed and this book is more than helpful in describing the correct file structure and NameSpace use required in components, modules, and plugins. It also helpfully makes the distinction between modules and plugins so I understand that one produces something I see, and the other affects what I am already seeing on screen.
As we near the end of the book, Chapter 13 helpfully spends time on aspects of security, handling form inputs, and making sure any data input is filtered before it gets to the database. Luckily this can be handled in the XML manifest file, so the form can be constructed, along with validations all in one place. It also takes us through other ways a site can be compromised, how to prevent attacks, and how to harden security.
The final chapter of the book, as you would expect in a journey through extension development, is a discussion on how to distribute Joomla extensions, including the method for commercial developers to charge for their work. To this end, the reader is fully equipped to go from a plan on a piece of paper, to a fully functioning application. Quite an achievement in 322 pages.
I felt that this book gave me a lot of what I needed to create an extension, the terminology, and the structure, but my need was also to understand why I needed to do the things it tells me. I could keep going round in circles looking for information on Joomla classes and services but that is a frustration I have at times with Joomla documentation. Luckily the reading resources are broader and the author’s choices are thoughtful, including Absolute Basics of How a Component Functions, which is a mustread. For my second read of this book, I will install the downloaded files and attempt to change the extension into my own. If I break something along the way then it will help me learn from my mistakes. This is a book that demands practical engagement to fully appreciate the magic of Joomla.