There is something bothering me right now and I haven't seen too much discussion about it. So, I have been doing research into RESTful API's and front end frameworks, and I have worked with laravel before.
However I just now figure that Blade does what developers used to do with PHP back in the days where the server would load html code as response to the client. This is a terrible practice now because that is just too much load in the server. Instead, what developers do now, is they create a RESTful API and then use a front end framework like Vue or Angular to consume that API. Such framework will keep the state of the app and info like authentication keys.
Now, we are talking of a big scale app. An app that has multiple smaller apps that will be reused allthrough. Is there any best convention in this case? Wouldn't having Blade loading the views would be a huge load in the server since it is technically loading a view in the server?
My personal experience is to base this off of your clients requirements. If they only require a simple web application or a webshop then using blade is fine! It isn't that much slower if it is at all. Basically I make a rest API for my projects if I feel the front-end requires some complex logic.
It is indeed easier to build an API for multiple environments to use at the same time, generally I build an API and use blade for page layout and giving data to my Vue components. Then my vue components interact with the API to prevent page loads and allow for said complex front-end logic.
If you are building a bigger infrastructure containing multiple apps I'd build a main API in laravel and hook em all up with Laravel Passport.
Disclaimer: I don't have that much practical experience with huge setups but I've seen projects where this structure worked perfectly fine.
However I just now figure that Blade does what developers used to do with PHP back in the days where the server would load html code as response to the client.
...which is exactly what developers still do today on many sites and it works just fine. And not just on small sites.
Not every project needs to be shoved through the reactive javascript sausage-machine.
This is a terrible practice now because that is just too much load in the server.
Measure it before you assume that's true. It may be true for some projects but not for others.
Bear in mind that offloading everything to the client has its own performance issues. It's possible to upgrade your servers, but you can't upgrade the client's old phone.
Ok, your point makes sense. However, when or how do I know when is it better to not load HTML code every time a new request for data comes in, and when would it make more sense? What about js templates like Jade or Pug, can't they be used isntead of Blade when using php as backend?
Nothing can be used except HTML that is the true front end. Any of the others simply Translate at runtime.
There is no such thing as a JavaScript front end rather JavaScript can be used to manipulate the front end.