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.2k↓79.2%MITPHPPHP ^8

Since Apr 18Pushed 10mo 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 yesterday

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

32

—

LowBetter than 69% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity18

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

1902d 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

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[symfony/ux-live-component

Live components for Symfony

1647.0M127](/packages/symfony-ux-live-component)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

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