Using PHP Enums for Laravel Shopify

Share
Using PHP Enums for Laravel Shopify
Photo by Xan White / Unsplash

I recently announced that I've became a maintainer for the Laravel Shopify package:

I’m now a maintainer for Laravel Shopify
I’m excited to announce that I’m now a maintainer for the Laravel Shopify package. This is a package that I’m using heavily at work so I have a vested interest in ensuring it lives on. I’ve already worked on a couple of things for it such as adding the ability

One of the things I'm heavily invested in is making the codebase more modern. Especially now since we've dropped < PHP83 and < Laravel 12. This means we can now start using some of the nice features that PHP has.

One of these is enums, which were actually introduced in PHP81, but now seems like a good time to start using them. The package does actually have the concept of enums, but it's via the funeralzone/valueobjects package.

So my plan is, to convert all of the classes to use native PHP enums as a step to eventually drop funeralzone/valueobjects as a dependency. Whilst it's served the package well, I don't believe we actually need it anymore and having one less dependency is always a good thing!