All posts by Piyush Handa

Using php constants and static functions directly in smarty template of Symfony2

The Symfony Framework is well-known for being really flexible and is used to build micro-sites, enterprise applications that handle billions of connections and even as the basis for other frameworks. Some time back we started using Symfony2 for our new projects. Symfony2 comes with twig as the default templating engine but we chose to use smarty as the templating engine using the SmartyBundle of Symfony2. Smarty is great, but for maintainability reasons, they have deprecated the possibility of adding php tags in the template. This means we will not be able to use php class constants... Read More

Better Practices in PHP – Speed up your code

“There's ALWAYS a way to fix something.” --Steven Wolff And when you are using PHP, there are multiple ways to fix something. What we need to determine is, that which way is the best. Computation is not like solving a maths problem, where simplicity can be determined by the number of lines. Computation requires resources, for example CPU Cycles and memory. Now when we have got multiple ways to solve a problem, we need to think in terms of computation and how much resources it will take. The objective is to accomplish the task in minimal number of steps, but different functions in... Read More