Back to Vol 21, Issue 7

PHP Architect · Vol 21, Issue 7 · July 2022

Artisan Way: Refactor to Enums in Laravel

by Marian Pop

You can create a custom type that is limited to one of a discrete number of potential values by using enumerations, sometimes known as “Enums.” Because it allows for “making incorrect states unrepresentable,” this is particularly useful when constructing a domain model.

The full article is in PHP Architect Vol 21, Issue 7. Subscribe to read it and every new issue.

Subscribe
Marian Pop

About the author

Marian Pop

Marian Pop is a PHP / Laravel Developer based in Transylvania. He writes and maintains LaravelMagazine.com and hosts "The Laravel Magazine Podcast".

Our Partners

Collaborating with industry leaders to bring you the best PHP resources and expertise

Interested in partnering? Get in touch →