PHPackages                             resist/twigphpfunctions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. resist/twigphpfunctions

ActiveLibrary[Templating &amp; Views](/categories/templating)

resist/twigphpfunctions
=======================

Small Twig extension that allows PHP functions in templates

1.0.0(5y ago)03.1k↓50%MITPHPPHP ^8

Since Apr 18Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/resist/TwigPhpFunctions)[ Packagist](https://packagist.org/packages/resist/twigphpfunctions)[ Docs](https://github.com/r3sist/TwigPhpFunctions)[ RSS](/packages/resist-twigphpfunctions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Twig PHP Functions - Twig extension
===================================

[](#twig-php-functions---twig-extension)

Allowing PHP functions in templates

---

Installation
------------

[](#installation)

`composer require resist/twigphpfunctions`

Usage
-----

[](#usage)

Constructor parameter is an array of built in PHP function names as string.

```
new TwigPhpFunctions(['ceil', 'floor']);
```

### In Symfony framework

[](#in-symfony-framework)

In *config/services.yaml*:

```
parameters:
    app.allowed_php_functions_in_templates: ['ceil', 'floor']

services:
    resist\Twig\TwigPhpFunctions:
        tags: ['twig.extension']
        arguments:
        $functions: '%app.allowed_php_functions_in_templates%'
```

### Without framework

[](#without-framework)

```
use resist\Twig\TwigPhpFunctions;
use const ALLOWED_PHP_FUNCTION_IN_TEMPLATES;

/** @var \Twig\Environment $twig */
$twig->addExtension(new TwigPhpFunctions(ALLOWED_PHP_FUNCTION_IN_TEMPLATES));
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance41

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1856d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15314f60ca260822456645d8465ee03a31525ab6d8ba8dc11c34d2df2fe83682?d=identicon)[resist](/maintainers/resist)

---

Top Contributors

[![resist](https://avatars.githubusercontent.com/u/2023543?v=4)](https://github.com/resist "resist (6 commits)")[![r3sist](https://avatars.githubusercontent.com/u/5300352?v=4)](https://github.com/r3sist "r3sist (2 commits)")

### Embed Badge

![Health badge](/badges/resist-twigphpfunctions/health.svg)

```
[![Health](https://phpackages.com/badges/resist-twigphpfunctions/health.svg)](https://phpackages.com/packages/resist-twigphpfunctions)
```

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91492.0M315](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36763.2M221](/packages/twig-intl-extra)[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[twig/string-extra

A Twig extension for Symfony String

22046.0M133](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22918.5M55](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21914.8M162](/packages/symfony-ux-twig-component)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
