Separating concerns in the backend with decoupled PHP classes and libraries

Presenters: dafeder, fmizzell

We talk a lot about separation of concerns between front and back end, but getting more granular, separation of business logic into self-contained parts can be a big win for your Drupal project. Now that Drupal uses composer for dependency management and class autoloading, business logic can often be taken out of module files that make heavy use of Drupal APIs and services, and isolated in PHP classes, either within module subdirectories or as separate libraries. This session will review several methods for doing this, demonstrate how to separate pieces of your application into separate PHP libraries and how to manage them as dependencies, how to optimize for a minimal number of integration points with Drupal core, and reap benefits in code maintainability and test coverage.

Experience Level
Session Track