PHPackages                             palmiot/twig-extensions - 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. palmiot/twig-extensions

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

palmiot/twig-extensions
=======================

A number of useful filters for Twig.

1.0.0(5y ago)1779—8.9%MITPHPPHP &gt;=5.3.0

Since Oct 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/palmiot/twig-extensions)[ Packagist](https://packagist.org/packages/palmiot/twig-extensions)[ Docs](https://github.com/palmiot/twig-extensions)[ RSS](/packages/palmiot-twig-extensions/feed)WikiDiscussions master Synced 2d ago

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

twig-extensions
===============

[](#twig-extensions)

A number of useful filters and functions for Twig.

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

[](#installation)

The extensions can be easily installed using [composer](http://getcomposer.org/)

```
composer require palmiot/twig-extensions
```

Usage
-----

[](#usage)

```
$twig = new Twig_Environment($loader, $options);
$twig->addExtension(new Palmiot\Twig\Base64Extension());
$twig->addExtension(new Palmiot\Twig\BasenameExtension());
$twig->addExtension(new Palmiot\Twig\MinifyExtension());
$twig->addExtension(new Palmiot\Twig\PackerExtension());
$twig->addExtension(new Palmiot\Twig\PathinfoExtension());
$twig->addExtension(new Palmiot\Twig\RemoteFileExtension());
```

To use in a symfony project [register the extensions as a service](http://symfony.com/doc/current/cookbook/templating/twig_extension.html#register-an-extension-as-a-service).

```
services:

  twig.extension.base64:
    class: Palmiot\Twig\Base64Extension
    tags:
      - { name: twig.extension }

  twig.extension.basename:
    class: Palmiot\Twig\BasenameExtension
    tags:
      - { name: twig.extension }

  twig.extension.minify:
    class: Palmiot\Twig\MinifyExtension
    tags:
      - { name: twig.extension }

  twig.extension.packer:
    class: Palmiot\Twig\PackerExtension
    tags:
      - { name: twig.extension }

  twig.extension.pathinfo:
    class: Palmiot\Twig\PathinfoExtension
    tags:
      - { name: twig.extension }

  twig.extension.remotefile:
    class: Palmiot\Twig\RemoteFileExtension
    tags:
      - { name: twig.extension }
```

Base64 extension
----------------

[](#base64-extension)

Exposes base64 functions to Twig for encodes and decodes data with MIME base64.

```
{{ "palmiot/twig-extensions"|base64_encode }}
{{ "cGFsbWlvdC90d2lnLWV4dGVuc2lvbnM="|base64_decode }}

```

Basename extension
------------------

[](#basename-extension)

Exposes [basename](https://www.php.net/basename) to Twig for returns trailing name component of path.

```
{{ basename("/etc/sudoers.d") }}
{{ basename("/etc/sudoers.d", '.d') }}

```

Minify extension
----------------

[](#minify-extension)

For compress CSS ( Cascading Style Sheets ) and JS ( JavaScript ) from Twig. ( Using the compress [MatthiasMullie\\Minify](https://github.com/matthiasmullie/minify) )

```
{{ minify('css', "-0px") }}
{{ minify('js', "object['property']") }}

```

Packer extension
----------------

[](#packer-extension)

For pack JS ( JavaScript ) content from Twig. ( Using the packer [Tholu\\Packer\\Packer](https://github.com/tholu/php-packer) )

```
{{ packer("alert('checking this');") }}

```

Pathinfo extension
------------------

[](#pathinfo-extension)

Exposes [pathinfo](https://www.php.net/pathinfo) to Twig for get information about a file path.

```
{{ "/www/htdocs/inc/lib.inc.php"|pathinfo('PATHINFO_DIRNAME') }}

```

or

```
{% set pathData = "/www/htdocs/inc/lib.inc.php"|pathinfo %}
{{ pathData.dirname }}

```

RemoteFile extension
--------------------

[](#remotefile-extension)

For get contents of any URL and save as new file if you want.

```
{% set content = remote_content("https://...") %}
{% set localFileName = remote_file("https://...", "../templates", "test.html.twig") %}

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

2075d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/72756629?v=4)[David Palmero](/maintainers/palmiot)[@palmiot](https://github.com/palmiot)

---

Top Contributors

[![palmiot](https://avatars.githubusercontent.com/u/72756629?v=4)](https://github.com/palmiot "palmiot (1 commits)")

---

Tags

symfonytwigclassextensions

### Embed Badge

![Health badge](/badges/palmiot-twig-extensions/health.svg)

```
[![Health](https://phpackages.com/badges/palmiot-twig-extensions/health.svg)](https://phpackages.com/packages/palmiot-twig-extensions)
```

###  Alternatives

[craue/twigextensions-bundle

Useful Twig extensions for your Symfony project.

79216.1k2](/packages/craue-twigextensions-bundle)[yepsua/smartwig-bundle

The jQuery, jQueryUI (and more) Symfony Bundle

224.0k3](/packages/yepsua-smartwig-bundle)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)[nurikabe/star-rating-bundle

Symfony form type and Twig extension for quick integration of FyneWorks' Star Rating widget

113.1k](/packages/nurikabe-star-rating-bundle)

PHPackages © 2026

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