7
Consider the following architecture:
This is a very modern model where the API offers end-points for different services to transact with the database.
I am a begginer user in Laravel, so my question is beginner regarding the Framework.
Laravel, like other frameworks like Simfony for example, has a powerful ORM that saves a lot of development time. In Laravel the Eloquent seems to be tbm the basis of many other amenities like Migrations, Seeds, authentication layers, among others.
If the previous idea is true, it seems logical to me that if we decide not to use the Laravel ORM, or the Migrations we will lose much of the power of the Laravel.
On the other hand, thinking of the drawing scheme above, how would the implementation of a Web Site/APP that only consumes end-points of a API? At the moment I’m using Guzzle to make use of the end-points. But in this case, my Web Website/APP You won’t need the ORM, you won’t need the Eloquent, and I won’t need the Séeds or the Migrations. So it seems logical that in this scenario I’ll be losing the advantages of the Laravel.
And if that conclusion is true, I will inevitably be forced to question Laravel’s advantage for nonmonolithic architectural designs.
Even inside the API-Restful where I could use all the amenities of the ORM the use of Laravel is questionable because here I will not need the views, I will not use Lade and tbm the whole package of associated amenities.
Perhaps that is why there is a Ligth version of Laravel to treat the development of Apis, the Lumen, which, according to its website, brings us the advantage of having something around 1900 connections per second. But tbm there are other options for developing php Apis such as Phalcon, in addition to Lumen, which are considered high-performance php frameworks. In addition there is the possibility of using Javascript with Nodejs to develop the API completeness. The purpose here of this post (which is my question), is not to discuss the performance of each of these options or qualify who is worse or better.
The fact is that looks like that the Laravel 5.x framework (5.4 is what I’m using now) does not seem to be tbm the appropriate choice to create the API (if chosen to be done in PHP).
Well, if to create the Web Site/APP The Laravel, who will not use the ORM and its amenities, seems to have no meaning, and for the creation of the API Laravel seems tbm not to be the first choice, we would have to conclude that Laravel (and other similar frameworks) is not a good choice for microservice design and by conclusion, the modern web.
So not to leave that thought open, so that if you set it off-topic, you get my exact question:
How to implement Laravel’s ORM in a Web Site/APP project that will consume end-points from an API? Will you need to have the Models or can the data already come straight from the Controllers? Will you have to replicate the entire database in Migrations and Models in order to use the benefits of queries? I can’t see how to implement this ORM.
In a mobile api I built, the use of the Laravel or Lumen became very heavy and needed to consider as many requests as possible with a very limited server, ended up building a custom MVC framework with what I needed and just installing Eloquent as ORM
– Antonio