Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Getting started - Drupal technical documentation

14/04/2025, by Ivan

Drupal 8 uses a range of advanced PHP features and sophisticated third-party libraries to provide third-party developers with the most advanced API of any available CMS. While experienced Drupal 7 developers may notice some significant changes, much of the core structure remains familiar.

If any of the material presented in the step-by-step D8 module developer guide is new to you, the resources below may help. However, exhaustive knowledge is not required to proceed to the D8 module walkthrough.

Object-Oriented Programming

OOP, though initially intimidating, has become well-established as the best approach.
For a general overview of PHP best practices, visit phptherightway.com. Drupal doesn’t use every tool and method documented there, but it provides an excellent introduction to PHP and many of its features.

Refresh your OOP knowledge by reading the official PHP documentation on classes and objects, along with these helpful tutorials:

Drupal 8 also uses common design patterns, and it helps to be familiar with them:

Factory Pattern and Late Static Binding
Software Design Patterns (Wikipedia)
Foundations: Design Patterns (Lynda.com)
@todo: Add additional documentation links for commonly used patterns...

PHP Namespaces

If you're unfamiliar with PHP namespaces, try these articles:

In most cases, Drupal code is namespaced based on the module it belongs to.

Example: namespace for block.module

namespace Drupal\block;

@todo: Explain when to use Drupal\ vs Drupal\\[Controller|Form|Plugin|etc.] and how to determine the correct one...

Learn more about Drupal naming standards and the use of PSR-4 in Drupal. A properly configured code editor should be able to recognize namespaces and provide hints and autocomplete.

Dependency Injection

Although dependency injection is another OOP design pattern, it's highlighted separately here because Drupal 8 makes heavy use of it. Understanding the basics is important for working with many of Drupal's core APIs.

Read about Dependency Injection in PHP and other resources on that page. Especially this article, as Drupal extensively uses the Symfony service container referenced therein.

See also:

Symfony

Symfony is a PHP framework that Drupal leverages to reduce code duplication across PHP projects. Much of the code Drupal 8 uses for routing, sessions, and the service container (among others) is adopted from Symfony 2 (and updated to Symfony 3 as Drupal 8 evolved). To learn more about this decision, see this presentation by core committer alexpott.

Read the Symfony 2 book to brush up. While not all is required for Drupal development, understanding Symfony will make you a better Drupal and PHP developer. You may also find the Symfony glossary useful.

Check core/composer.lock to see Symfony libraries. As of Drupal 8.6.15, the following are included:

...
"symfony/class-loader": "~3.4.0",
"symfony/console": "~3.4.0",
"symfony/dependency-injection": "~3.4.26",
"symfony/event-dispatcher": "~3.4.0",
"symfony/http-foundation": "~3.4.26",
"symfony/http-kernel": "~3.4.14",
"symfony/routing": "~3.4.0",
"symfony/serializer": "~3.4.0",
"symfony/translation": "~3.4.0",
"symfony/validator": "~3.4.0",
"symfony/process": "~3.4.0",
"symfony/polyfill-iconv": "^1.0",
"symfony/yaml": "~3.4.5",
"twig/twig": "^1.38.2",
"doctrine/common": "^2.5",
"doctrine/annotations": "^1.2",
...

Annotations

Drupal 8 uses PHP annotations—@docblock comments added using specific syntax—to discover plugins and provide metadata/context for executable code. These annotations are parsed by the Doctrine Annotation parser (v1.6) and turned into metadata that Drupal uses to understand your code better.

Learn more about using annotations for plugin discovery.

See the list of annotation types used in Drupal 8.

Also see: PHPDoc (Wikipedia)

Plugins

Plugins provide small units of functionality in a way that allows them to be swapped easily. Plugins with similar functionality belong to the same plugin type. For example, a "Field Widget" is a plugin type, and each widget (e.g., textfield, textarea, date) is implemented as a plugin.

Learn more about the Plugin API in Drupal 8.

Services

In Drupal 8, a service is any object managed by the service container. The concept of services was introduced to isolate reusable functions and make them pluggable and replaceable via registration in the dependency injection container, which ties in closely with dependency injection.

Also see: Service Container for Drupal Geeks

Additional Resources

Here are some additional resources to help you get started with Drupal 8:

Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.