menu

arrow_back How to properly integrate api into an MVC pattern?

by
1 vote
I have a site in PHP, it is implemented using MVC pattern. About the standard work with the site I understand, but how do I properly integrate api here? Where do I work with it? In controller or model? Where do I save the api files?

1 comment

Understand what MVC is, then the question goes away

2 Answers

by
1 vote
- How much is 2+2 ?
- Are we selling or buying?

My point is this. If the site is to implement an api for an external system, then
It's practically a normal site, only the response is in the form of json/xml, etc.

If the site needs other people's data, the model.
It is better to make an external library (class) and a wrapper mediator for the framework model .
by
4 votes
Also.