Skip to content

qfox/php-bem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Deprecation notes

This is a stillborn project.

If you are looking for BEM-based rendering library for php you should take a look bem/bh composer package or just use bem-proxy between your php-fpm and nginx servers to render pages on the fly.

Don't waste your time with v8js+php. 🌴


php-bem (deprecated)

BEM render library usign v8js extension (https://github.com/preillyme/v8js)

Based on https://github.com/bem/bem-bl-test.git

How to start?

That class requires on php5.3+ and v8js extension. Also it needs nodejs0.8+.

What you need to use it?

$ sudo pecl install v8js-0.1.3

You can try newer version but I was stopped on 0.1.3 at the moment.

When you finished you can verify your new extension installation:

$ php -m |grep v8js
v8js

Let's get BEM for php!

Clone repository to some place on your pc and prepare bem to use:

cd ~/repos
git clone git://github.com/zxqfox/php-bem.git -b examples
cd php-bem
pushd .; cd bem-bl-example/www; npm i; make; popd

Done. Let's try it now!

php phpbem/test.php

If you don't see some output please contact me with issues ^_^

How to use it

// include class
require "./phpbem.php";
use \bem\bemhtml;

// and use it like that:
$bem = new bemhtml($rootpath, $options = array());
$bem->page($pathToBlock)->render($context, array $env, string $entrypoint = 'render', $json = false);

// or like that:
$bem = new bemhtml($rootpath, $options = array());
$bem->page($pathToBlock, [$block.'.'.$tech.'.js']);
$bemjson = $bem->json(array $context, array $env, 'render');
echo $bem->render($bemjson);

About

💩 (DEPRECATED) BEM render usign v8js extension (pecl)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages