PHP 8.1 brings Enums, one of the most requested features in PHP.

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 PHP applications.
Audience

This session is for those who are familiar with modern PHP practices such as Object Oriented Programming, principles such as Liskov Substitution principle; familiarity with such concepts can help a lot.
What you will learn

- 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.

## Author
Ayesh Karunaratne is the author of PHP.Watch (https://php.watch), where he provides in-depth articles and documents on PHP and latest changes to the language.

- PHP 8.0: https://php.watch/versions/8.0
- PHP 8.1: https://php.watch/versions/8.1
- Enums: https://php.watch/versions/8.1/enums

Comments

Comments are closed.

Beautiful animations clearly explain the benefits of Enums from the old style. I already love Enums, but I reaffirmed their goodness. Great talk!