V
V
Vitaly2016-04-01 03:11:15
Laravel
Vitaly, 2016-04-01 03:11:15

How to tie BEM to Laravel?

Tell me how to attach BEM with its modules and assemblers to a Laravel project?
At the moment, the project uses the Blade templating engine, but as far as I understand, BEM should work with pure JSON. which needs to be given from controllers. But how to organize it correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JhaoDa, 2016-04-01
@JhaoDa

I have experience of screwing BEM to Laravel in collaboration with a BEM layout designer, and we came to the conclusion that bh-php creates extra work, because the layout designer first writes js templates and debugs it on the enb server, and then also redoes it for php .
Nevertheless, the project has been written and the package has been developed (but it has not yet been formalized as a package).
The best option is the nodejs layer, which accepts json from the laravel backend and renders as it should. On this mechanism, a second project is developed and a package is made again.
If you are interested, then write, we will think of something.

A
Andrzej Wielski, 2016-04-01
@wielski

The compiler itself in php: https://github.com/bem/bh-php
There is also an interesting class for modeling the structure directly in php: https://habrahabr.ru/post/249629/
If I were you, I would expand Blade the necessary functionality, so as not to lose its charms.
This will allow you to use all the features of the blade (including various kinds of loops, conditional statements, etc.), and will also not violate the basic rules of MVC - controllers and views will be separated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question