The original post: /r/php by /u/wtfElvis on 2025-01-18 23:00:05.
Trying to determine the best route to go here. I have a pretty good opportunity to start something fresh with my company implementing a client API. We will basically have them send us specific data but not every vendor does it the same way. So I’d like to also have an additional structure for custom data that would fit into the concrete api data
So an example would be:
Interface
GetData1 GetData2 GetData3
In order for a successful transfer of data we must have the data formatted a specific way, obviously.
But client may do “GetData1” differently by providing additional data points that we can transform into the way we need “GetData1”. But others may not and want to just give it to us exactly how it’s needed without additional data.
So we can set abstract classes for each client but I was hoping thatAra each time that happens instead we make it a generalized class so that we could potentially use that option as a selling point for future clients that may want to do something similar.
What specific design pattern should I steer myself towards that would fit this?
I want a very specific structure but allow flexibility in how the data points for that structure are set