PHPackages                             mehrkanal/twig-encore-extension - 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. mehrkanal/twig-encore-extension

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

mehrkanal/twig-encore-extension
===============================

Twig Extension to use entrypoints.json in Twig Templates

4.0.2(2y ago)44.3kGPL-3.0-or-laterPHPPHP ^8.1

Since Apr 28Pushed 2y ago2 watchersCompare

[ Source](https://github.com/mehrkanal/twig-encore-extension)[ Packagist](https://packagist.org/packages/mehrkanal/twig-encore-extension)[ RSS](/packages/mehrkanal-twig-encore-extension/feed)WikiDiscussions develop Synced today

READMEChangelog (5)Dependencies (7)Versions (9)Used By (0)

Twig and Webpack Encore Extension for Laminas
=============================================

[](#twig-and-webpack-encore-extension-for-laminas)

To use with `twig/twig` and `symfony/webpack-encore-bundle`

Created for: `Laminas/Mezzio` Applications without native Symfony Kernel.
**Warning:** If Symfony is available, just use the `symfony/webpack-encore-bundle` bundle as is.

How to use and configure Encore
-------------------------------

[](#how-to-use-and-configure-encore)

1. `composer require symfony/webpack-encore-bundle`
2. npm i @symfony/webpack-encore
3. webpack.config.js
    - `setOutputPath()` should be in the public folder
        - i.e. `.setOutputPath('public/assets')`
    - `setPublicPath()` should be in the folder where the assets are in
        - i.e. `setPublicPath('/assets')`
4. Set `['twig']['asset_url']` to the absulute Path, for example in your [twig.global.php](twig.global.php.dist)
    - Best be set to: `/app/public/assets/`
    - Note: A Forward Slash is appended after asset\_url in case the preceding path does not end on a forward slash
        - i.e. asset\_path is `/assets` the url will be `/assets/entrypoints.json`
5. Include `Mehrkanal\EncoreTwigExtension\ConfigProvider::class` into your global config
6. Include `Mehrkanal\EncoreTwigExtension\Extensions\GetCssSourceTwigExtension:class` to your `['twig']['extensions']` config.
7. Include `\Symfony\Bridge\Twig\Extension\AssetExtension::class` to your `['twig']['extensions']` config.
8. Include `Symfony\WebpackEncoreBundle\Twig\EntryFilesTwigExtension:class` to your `['twig']['extensions']` config.

```
use Mehrkanal\EncoreTwigExtension\Extensions\GetCssSourceTwigExtension;
use Symfony\WebpackEncoreBundle\Twig\EntryFilesTwigExtension;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;

require_once 'vendor/autoload.php';
$container = require __DIR__ . '/container.php';

$loader = new FilesystemLoader('./templates');
$twig = new Environment($loader, [
	'debug' => true
]);

$twig->addExtension($container->get(EntryFilesTwigExtension::class));
$twig->addExtension($container->get(GetCssSourceTwigExtension::class));
```

What can I do now?
------------------

[](#what-can-i-do-now)

- Use Encore NodeJS Scripts to automatically generate assets
- Use `encore_entry_link_tags()` function in Twig to get all required stylesheet link tags
- Use `encore_entry_script_tags()` function in Twig to get all required script tags
- Use `encore_get_css_source()` function in Twig to get all CSS Code from this entrypoint

Use in combination with setEntry of Encore Webpack Config.

Stan
----

[](#stan)

```
docker run -it -v $PWD:/app -v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -w /app -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK -e SSH_AGENT_PID=$SSH_AGENT_PID registry.mehrkanal.com/docker/phpx/cli:8.1-build bash

composer up
composer run stan
composer run cf
```

Useful links:
-------------

[](#useful-links)

- [Original Code](https://github.com/symfony/webpack-encore-bundle/blob/master/src/Twig/EntryFilesTwigExtension.php)
-
-

Team
----

[](#team)

[MKLabs](https://confluence.mehrkanal.com/display/MKLAB/)

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

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

Every ~131 days

Recently: every ~66 days

Total

7

Last Release

999d ago

Major Versions

v1.3 → v2.02022-10-07

v2.0 → 3.0.02022-11-23

3.0.0 → 4.0.02023-06-27

PHP version history (3 changes)v1.2PHP ^7.1

v1.3PHP ^8.0

4.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f091f0a9632c60556cb9c76e2598a2791f06c9949f2b16a796d4574d1ed68213?d=identicon)[notdefine](/maintainers/notdefine)

---

Top Contributors

[![notdefine](https://avatars.githubusercontent.com/u/12696553?v=4)](https://github.com/notdefine "notdefine (6 commits)")[![lcharette](https://avatars.githubusercontent.com/u/2566513?v=4)](https://github.com/lcharette "lcharette (2 commits)")[![mk-frauenholz](https://avatars.githubusercontent.com/u/71311987?v=4)](https://github.com/mk-frauenholz "mk-frauenholz (2 commits)")[![mk-wieland](https://avatars.githubusercontent.com/u/92921069?v=4)](https://github.com/mk-wieland "mk-wieland (1 commits)")

###  Code Quality

Static AnalysisPHPStan, Rector

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mehrkanal-twig-encore-extension/health.svg)

```
[![Health](https://phpackages.com/badges/mehrkanal-twig-encore-extension/health.svg)](https://phpackages.com/packages/mehrkanal-twig-encore-extension)
```

###  Alternatives

[sonata-project/twig-extensions

Sonata twig extensions

9110.6M18](/packages/sonata-project-twig-extensions)[boekkooi/jquery-validation-bundle

Jquery form validation bundle for symfony 2

2773.9k1](/packages/boekkooi-jquery-validation-bundle)[symfony2admingenerator/form-extensions-bundle

Add additional form types to symfony2

1331.6k1](/packages/symfony2admingenerator-form-extensions-bundle)

PHPackages © 2026

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