In my company, we have developed some applications. We need to create an API for one application (for example, application A) so that others can use it (their data).
Question: we have already developed PHP classes for application model A, if we want to create an API, we must:
- reuse these classes (too much functionality for the API, too heavy ...)
- create one PHP class with some basic functions that takes input and returns only the original values (for example, strings, arrays ... NOT complex classes)
- create another set of PHP classes, simpler and designed only for use by an external application (so only for easy data retrieval)
Typically, the API is the second solution (which should also be used with PHP than as a web service, for example), but I think it's too bad that we made a complex and useful model model, then we break it just have functions, lines and arrays. The third seems to me a compromise, but my colleague insists that this is not an API. Too bad...
What do you think?
source
share