1-3 March 2019

City, University London

Dependency Injection in PHP and Drupal

  • Basic PHP coding skills
Session details

Dependency Injection sounds like a fancy term for something complicated and advanced. After all, most people didn’t start hearing about this until recently when the PHP world was overtaken by object-oriented programming. Dependency Injection sounds intimidating, but it is not. It is simple to understand and once you do, using it in PHP and Drupal is very easy.

In this session, you will learn what Dependency Injection is and how it helps you structure your programs better. You will learn some very basic concepts like constructor injection with analogies and examples and then move on to see how it is done in real life.

Most times, dependency injection is implemented with containers. You will learn how to use some simple dependency injection containers like Pimple in your PHP application. You will also learn how dependency injection is implemented in frameworks like Laravel and Symfony. We will focus on Symfony the most since Drupal uses Symfony’s dependency injection container.

By the end of the session, you will understand:

  • What is Dependency Injection and how does it help us
  • Constructor and setter injection
  • Why do we need Dependency Injection Containers
  • How to use Dependency Injection in simple PHP applications and frameworks like Laravel
  • How to use Dependency Injection in Symfony and Drupal 8
  • How to write YAML files to define services and their dependencies
Skill Level
Session Track

Keynote speakers

Rowan Merewood

Developer @ Google

Saturday AM

Preston So

Director of R&I @ Acquia

Sunday AM

Sally Young

Developer @ Lullabot

Closing Keynote

Drupal apprentices

The best people to train new developers are developers

The Drupal Apprenticeship Scheme will be running a London intake in March. If you are interested in hiring an apprentice or know someone who would benefit from the scheme please get in touch via the link below.

  • Created and run by experienced developers
  • Teaches core skills and best practice
  • Extensive support for businesses and teams

We are also really keen to hear from people who might be interested in mentoring, training and helping us to develop and review training materials to make sure they stay absolutely current and relevant.

Find out more

Join the Drupal Association

The Drupal Association unites a global open source community to build and promote Drupal.

The Association is a not-for-profit organization that relies on individuals and businesses to fund everything they do for Drupal — from drupal.org to DrupalCon and community programs.

Connect with us and support our mission-driven work.

Support the Drupal Association

Hosting provided by