logo

How much logic is too much logic in a PHP enum?

Enums can hold methods, but they shouldn't do everything

Joel Clermont
Joel Clermont
2026-06-15

PHP developers spent years working around the lack of enums with magic strings, class constants, and even interfaces full of constants. Native enums finally fixed that, but they also raised a new question. How much logic belongs inside one?

In the latest episode of the No Compromises podcast, Aaron and I talk through which methods feel right at home on an enum, like labels and small helpers that return data about the cases. We also explain why we think running Eloquent queries from an enum goes too far.

And we share a simple rule that keeps an enum from slowly turning into an overstuffed utility class.

  • 00:00 Why magic strings and constants fall short
  • 01:43 How PHP enums replaced interface constants
  • 02:26 What methods belong on an enum
  • 06:58 The rule for keeping enum methods focused
  • 10:44 Silly bit

Listen Now (13 min)

And after listening, don't forget to subscribe to the podcast, so you don't miss future episodes.

Here to help,

Joel

P.S. Want a second opinion on a design decision in your own codebase? Ask us directly in our community. Join our community.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice.