PHP 8.1 brings Enums, one of the most requested features in PHP. Enums, or Enumerations, allow creating strict and type-safe structures for fixed values. An Enum structure can hold a number of values that can also be backed with integer or string values. In this comprehensive session, we will discover what Enums are, why they are useful, how to apply them on our applications including Drupal, and things to watch out for when using Enums. This session is for those who are familiar with modern PHP practices such as Object Oriented Programming, and principles such as Liskov Substitution principle. A quick introduction will be given to catch up to speed, but familiarity with such concepts can help a lot.

What you'll learn from this talk:
- What are Enums
- Why Enums are useful
- How to use Enums
- Migrating from magic constants/values to Enums
- Backed Enums and storing/fetching Enum values with a database
- Using Enums in a Drupal context
- Caveats when using Enums

Comments

Please login to leave a comment

Alberto Arena at 11:22 on 18 Jun 2021

Great talk and excellent presentation. Thanks!

Nice introduction in the new Enums feature.

The structure of your talks was great and have a clear reason why we can use it and great examples.

The start early options before it is released are great as well.

Keep up the great work!

Great talk, very clear examples.
It got me all up-to-date about the new Enums so I don't have to read all the documentation anymore.

Jos Elstgeest at 11:36 on 18 Jun 2021

Great talk, clear examples, excellent introduction to Enums

Great Job!

Koldo Picaza at 11:46 on 18 Jun 2021

Very instructive. I enjoy it a lot. Thanks for the excellent talk.

Great and structured talk using nice slides with helpful animations !

Erwin Deckers at 14:47 on 18 Jun 2021

Excellent talk, great presentation! Hope to see more of you in the future.

Good presentation

Mark Baker at 10:51 on 19 Jun 2021

One of the features that I've most been looking for in PHP; and long overdue. Ayesh clearly has a great knowledge of enums, not just their implementation in PHP, but their value in coding as well. I'd followed the RFC closely, and read it so many times, but still gained new insights and a fresh perspective from this talk.
The slide animations also showed how much effort had been put into this presentation.

Good presentation, with clear code examples.