PHP Conference Japan 2021
採択
2021/10/03 13:00〜
Track4
Long session (60 mins)
PHP8

PHP 8.1: Enums

Ayeshlive Ayesh Karunaratne Ayeshlive

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.

Discord Channel: #php4-6-php81-enum
Joind.in: https://joind.in/event/php-conference-japan-2021/php-81-enums