Module Development

The Wonder of Class Constants for Drupal 8, 9

Sprout Video

In this PHP tutorial, you'll get the project files up and running and learn all about class constants in object-oriented PHP.

If you're serious about getting really good at this stuff, code along with me. To do that, download the source code from this page, unzip it, and move into the start directory. When you do that, you'll have the same code that I have here. Open up the README file and follow the instructions inside to get things setup.

When that's done, open your favorite terminal application, move into the directory, and — like we've done in the previous courses — start the built-in php web server by running:

php -S localhost:8000

This is a great server to use for development. Then, in our browser, we can go to http://localhost:8000. Here is our beautiful Battles app!

Additional resources

Introduction to Object-Oriented PHP (Drupalize.Me)
Object-Oriented PHP Part 2 (Drupalize.Me)
Object-Oriented PHP Part 3 (Drupalize.Me)