You should use the strategy pattern wherever you have a bunch of nested if statements.

Like:

if ($env == 'dev') { do this } else if ($env == 'prod') { do this }

that would be a prime candidate for the strategy pattern.

Throughout my career, I’ve seen tons of misuse of Inheritance to accomplish things where the Strategy Pattern is much more suitable.

For those of you who’ve seen ecommerce apps, how often do you see something like this:

class CartItem { }
class GiftCardItem extends CartItem { }
class WishlistItem extends CartItem { }

It might make more sense to use the strategy pattern instead and put GiftCard and Wishlist item logic into separate classes.

Then you’d have something like this:

class WishlistItem_Logic { }
class GiftCardItem_Logic { }
class RegularItem_Logic {}
class CartItem {
protected $itemLogic;
}

This way, it wont be so brittle whenever you have to change some behavior in RegularItem_logic you wont have to add lots of ifs elses in everything that would otherwise extend from it.