PHP Enums
summary
PHP 8.1 introduces true enumerated types that replace magic constants with a strict type you can use as parameter, return and property types; two flavors exist: unit enums (no values) and backed enums (string or int values) with automatic .name and .value, static and instance methods, cases() to list members and from/tryFrom to convert DB or API values back; enums are final (no extension), disallow properties, require PHP 8.1 and Composer 2.1 for autoloading, and require adapters for ORMs like Doctrine when persisting.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:26PHP Enums
- 2:38Topics
- 3:14curl request
- 4:28curl setup
- 8:40typescript
- 13:46PHP 81
- 28:40Usage Examples
- 31:57Backwards Compatibility
- 34:10Questions








