Search code examples
phplaraveltemplatescakephptemplating-engine

PHP: as API+Views or just API


Note: This is an opinionated question. I m asking this as I was unable to find proper articles covering my concern.

PHP (alone or with a framework like laravel) can be used for both backend and frontend (with templating engines like Blade,Smarty,etc) development.

My concern is:

  1. Is it good to use templating engine and create views in PHP?
  2. Use PHP just as a backend tech and create APIs, let the frontend be built in any other language (like Angular,React,etc) chosen by the front end developer.
  3. If I use templating-engine, is my application getting too tightly coupled between frontend tech choices and backend tech choices?

PS: I hope my concern is clear, if not I will explain it in an elaborated way.


Solution

  • My opinion: If You are building small-medium size web project, don't bother to use frontend frameworks, because You just don't so much horses in such small environment. But when it comes to larger project with scaling - it is recommended to use some kind of frontend framework, because eventually that kind of project will be (or it should be) maintained by a team, so backenders can focus on backend - frontenders on frontend.

    A lot of folks says that web developer is a web developer, there is no backend or frontend. But in my opinion, they are just not faced that kind of project where You need separate things.

    You can be good at everything or You can be master and specific niche, choose Your path wisely.