API style MVC application architecture

I am working on a “community” website, both for pleasure and for profit, and although the aesthetic element is doing well, I have not yet buried my teeth in developing application logic for reasons of Inability in my approach.

I am creating a framework based on PHP MVC, which I hope will reuse components, however, I noticed that many existing MVC structures use some kind of “configuration convention” to speed up the whole process. Some of the queries I plan to run are a little more complicated than SELECT * FROM entity_name.

I want to create an application in layers so that API calls can be made on the server. I decided that instead of doing everything twice, I would build my site controllers on top of this layer so that everything would conform to the standard. This will allow Ajax calls, remote web application calls, etc. Follow the same route as query normalization and response in the form of web-based document requests.

In any case, perhaps most of this is an unnecessary detail, but can anyone shed light on multilevel MVC architectures with the same level? Since the API level (model level), where the data is ultimately read / written, would like to enable authentication at this level or an abbreviation to a higher level and make this entry point? What other considerations should I make that I did not mention?

I know that I still have a lot of reading, so any suggestions for reading materials or advice from personal experience are very welcome. Thanks in advance.

+3
source share
1 answer

This is a very good question. I think it is best to use a SOA approach with REST resources as much as possible. If your site receives a lot of hits, it may cost segregation of the state that mutated from the disclosure of the state, so the first one can use a more complex approach OO the other one can use simple DTOs (in the form of arrays) and retrieve data from the database using user queries.

+1
source

Source: https://habr.com/ru/post/1794191/


All Articles