user2869411
user2869411

Reputation:

Template engine + Front end framework

I apologize if this is a duplicate, but I honestly didn't find a similar enough question (or more specifically, answer)

I am working a project right now that involves using Twig template engine AND Vue.js on the front end. I know some larger frameworks offer similar combinations (Laravel uses Blade and includes Vue).

Is this too much? For a smaller project (in PHP with an ORM), is there any clear advantage to having both a templating engine AND a front end framework like Vue?

I hope this question is clear enough.

Thanks

Upvotes: 2

Views: 590

Answers (1)

DfKimera
DfKimera

Reputation: 2146

This is very common, on both small and large apps, and there are benefits and drawbacks as any technology choice would have.

The primary benefit you have is having server-side rendering of your content (at least partially) with the Twig templates, and being able to use server-side code (such as service or model helpers) that output straight to the front-end. If you're not looking to implement a large API on your back-end, having both can be a good choice.

The main drawback here, I believe, is the mental context switch required to change from server to client side, and if you have colliding functionality, you may end up implementing the same feature twice.

In the end, you should consider your experience with both tools, what kind of functionality/experience you're trying to build, and how much time/resources you have available, and make the decision that works best for you :)

Upvotes: 2

Related Questions