Skip to content

Instantly share code, notes, and snippets.

@zburgermeiszter
Last active March 23, 2020 10:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zburgermeiszter/b8c5c1cf4e1830cd66e6 to your computer and use it in GitHub Desktop.
Save zburgermeiszter/b8c5c1cf4e1830cd66e6 to your computer and use it in GitHub Desktop.
TWIG MD5 extension for Symfony
<?php
namespace Vendor\Bundle\Twig;
/*
services.yml:
twig.md5:
class: Vendor\Bundle\Twig\Md5
tags :
- { name: twig.extension }
*/
class Md5 extends \Twig_Extension {
public function getFilters(){
return array(
new \Twig_SimpleFilter('md5', 'md5')
);
}
public function getName(){
return "md5_hash";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment