Building an independent PHP library instead of a Drupal module - benefits, challenges and best practices
With Drupal boldly leaving its own island and learning to better co-operate with the rest of the PHP world several possibilities open up. We have the tools and techniques in place to easily integrate external libraries into our applications the same way Drupal core does.
In the past couple of years this outward looking trend has also extended into Drupal developers considering whether to build independent PHP libraries instead of just Drupal modules. Drupal Commerce is the most visible example while the Bookings and Availability Management (BAT) module that I co-maintain does the same.
In this session we will talk about when this approach is worth taking, the benefits and disadvantages and then dive in straight into the practicalities of it. Drawing from our experience of building a completely independent PHP library with the express intent of then using it with Drupal 7 and Drupal 8 modules we will share some of the practices we found useful. We will also look at the architecture of some other libraries and how other modules use them (e.g. Drupal Commerce) to identify emerging patterns.
Building independent libraries is a great way to be able to innovate and integrate with the wider PHP world while keeping a firm footing within the Drupal world. Come learn how we and others did it and discuss what are lessons that can be shared with the wider Drupal community.