RSS Feed
^__^

Twig Extension for Money value object

,

I just released a twig extension for https://github.com/sebastianbergmann/money

The money libary contains a money represention based on the currency’s smallest unit to provide a more accurate handling. See the libary’s readme for more information.

Although the v1.x version of Money brings a Formatter the Twig extension uses its own, which is better suited and more flexible.

» read more

Enable Twig-Extensions in Silex revisited

,

As of 2014 things have changed improved a lot in the Symfony / Silex world, compared to 2011, when i first blogged about twig extensions in Silex.
Things got more easy, yay!

As Composer appeared, installation and autoloading is a breeze nowadays.
I presume here, that you have installed your Silex project via composer.
If so, you can install the twig extensions like this:
» read more

[Symfony 2] composer.json for a assumed-stable symfony 2 distribution

,

This small composer.json file is used in a project i am working on atm, feel free to use it at own risk. I will provide non-periodical updates and hopefully soon a full upgrade to symfony 2.1.x including doctrine orm 2.2.x.

I still did not get the point regarding dependency resolution, so i simply “composed” the composer file by writing down my own requirements (“i want only the hottest, newest stuff!!”, then tracked down the error messages, removing them by explicetly writing down the missing dependencies by using the latest “dev-*” versions. After that i tried to run the project, which actually did not work, but selective downgrade of some of the bundles (framework, security-extra blahblah) finally did the job. » read more

Modulo in Twig

,

Ever wondered how to use the modulo operator in twig, the template engine of symfony?

Actually its like in PHP:

{{ 11 % 7 }}

As described here

But i guess for most use cases modulus is used to check if a number is divisible by another number.
Therefore Twig has the very conveniant divisibleby test function.

{% if loop.index is divisibleby(3) %}

» read more