Expression Language is a new awesome component that got released in the latest Symfony2.4. This component allows string expressions to be parsed, compiled and evaluated in PHP. It was basically extracted from the Twig library that supports writing expression logic in templates.

As simple as:–

1
2
3
$expLang = new ExpressionLanguage();
$x       = "1+1";
echo $expressionLang->evaluate($x);

The previous code will output “2”!

It seems simple enough, but the benefits that it introduces are great! Especially when we talk about a company like Namshi, where there are dedicated and specialized content and marketing teams with hundreds of templates and segments of information that must be delivered and shown on the website. The goal is to provide the most flexibility to other departments in creating their information with the least overhead in terms of code maintenance to the development team.

Read on →
Copyright © 2014 Namshi
Powered by Octopress. Design credit: Shashank Mehta