1-3 March 2019

City, University London

Services and Dependency Injection in Drupal 8

Prerequisites
Basic PHP coding skills.
Session details

Drupal 8 introduces the concept of services to decouple reusable functionality and makes these services pluggable and replaceable by registering them with a service container. As a developer, it is best practice to access any of the services provided by Drupal via the service container to ensure the decoupled nature of these systems is respected.

Dependency injection is the preferred method for accessing and using services in Drupal 8 and should be used whenever possible. Rather than calling out to the global services container, services are instead passed as arguments to a constructor or injected via setter methods. 

In this session, you will learn below points:
- Core Services, Altering existing services, providing dynamic services
- Service Tags
- What is Dependency Injection and Dependency Injection for a Form with working example
- Why to use Dependency Injection instead of calling out the global services container.

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

platform.sh