Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ShaneTurner's avatar

Stuck: Need help with terminology, multiple external API

I've reached a point on a project where I'm stuck, and I think it's probably due to not knowing the right terminology to search for.

What I need to do is access external services via API. In this case, it's shipping. The customer buys a product and depending on the product type, a different shipping provider is used, and also a different external API.

Ie they order Ice Cream and need it delivered immediately so provider A is used, another time they order a large boulder, so provider B is used.

Internally I want to use the one API, that then uses the correct API externally depending on the product.

So, what's this concept called? Or even more awesome, are there existing tutorials for it?

0 likes
3 replies
vmitchell85's avatar

Not sure if there is better terminology but you'll probably want a contract and a number of other classes that implement this contract.

The contract will specify the specific functions that the other classes must have and you can then do the specific logic for each API in those classes.

Hope this helps.

ShaneTurner's avatar

Great! That's just the lifeline I need. I'll toddle off and go explore Contracts.

Please or to participate in this conversation.