# Parameters for custom Twig extension/function

**URL:** <https://discourse.slimframework.com/t/parameters-for-custom-twig-extension-function/188>\
**Category:** Questions\
**Created:** [April 29, 2016, 2:01am UTC](https://discourse.slimframework.com/t/parameters-for-custom-twig-extension-function/188 "2016-04-29T02:01:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLobos](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@TheLobos](https://discourse.slimframework.com/u/TheLobos)\
**Post date:** [April 29, 2016, 2:01am UTC](https://discourse.slimframework.com/t/parameters-for-custom-twig-extension-function/188/1 "2016-04-29T02:01:57Z")

</div>

I’ve noticed that the Twig Extensions don’t implement an interface. Does this mean that I can define their constructor to receive anything I want without breaking stuff all over the place?

Sorry, it’s quite late here and I’d rather get an informed answer before trying stuff which may have unintended consequences. Any points of wisdom are appreciated.

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [April 29, 2016, 12:34pm UTC](https://discourse.slimframework.com/t/parameters-for-custom-twig-extension-function/188/2 "2016-04-29T12:34:49Z")

</div>

See [Slim Twig Flash](https://github.com/kanellov/slim-twig-flash/blob/master/src/TwigMessages.php#L28) for an example of a Twig extension written for Slim. The Flash service provider is passed to the constructor.
