Object-oriented PHP utilizes classes and objects to organize code into reusable chunks. This approach helps us organize complex applications, such as Drupal, into modular code called classes that can be reused across the entire system. As a module developer, knowledge of object-oriented PHP is essential in order to understand the architecture of a module and the various forms it can take as well as how to implement custom functionality.
Example tasks
Confidence
Learning modern object-oriented PHP practices is a skill that will benefit you not only as a Drupal developer but also as a PHP developer. If you have a doubt about a certain feature working on your project, check php.net to see which versions of PHP are supported. Also, verify your version of PHP on your localhost as well as your web host.
Drupalize.Me resources
Related guides
External resources
-
Background and Prerequisites for Custom Module Development in Drupal (Drupal.org)
- This page on Drupal.org provides links to resources on Object-Oriented PHP, PHP Namespaces, Symfony, Annotations, Plugins, and Services
-
Why the big architectural changes in Drupal 8 (buytaert.net)
- There has been a lot of chatter about Drupal 8. Will Drupal 8 be performant? Will Drupal 8 be easy to develop modules for? Will I have to learn Symfony? Dries Buytaert addresses these concerns and explains why Drupal 8 introduces such big changes.
-
PHP Manual: Classes and Objects (php.net)
- The index of all official PHP project documentation on classes and objects
-
Objected-oriented programming conventions (api.drupal.org)
- This page covers PSR-4, namespaces, class naming, and other conventions as they should be used in the context of a Drupal project.
-
Services and Dependency Injection Container (api.drupal.org)
- An overview of the Dependency Injection Container and Services
-
Namespaces (Drupal.org)
- An overview of how Namespaces are used in Drupal
-
PHP Namespaces in under 5 minutes (symfonycasts.com)
- A video overview of PHP Namespaces
-
Object-Oriented PHP Tutorial Track (symfonycasts.com)
- Our friends at SymfonyCasts offer video courses that will bring you up-to-speed with object-oriented PHP concepts and practices.