PHPackages                             diasfs/twig-relative-path - 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. diasfs/twig-relative-path

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

diasfs/twig-relative-path
=========================

Twig extension to work with relative paths

1.0.1(1y ago)015811MITPHPPHP &gt;=7.1.3

Since Jul 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/diasfs/twig-relative-path)[ Packagist](https://packagist.org/packages/diasfs/twig-relative-path)[ RSS](/packages/diasfs-twig-relative-path/feed)WikiDiscussions main Synced 1mo ago

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

Twig Relative Path Extension
============================

[](#twig-relative-path-extension)

An extension for [Twig](https://twig.symfony.com/) that allows to include and extends templates using relative paths.

Instalation
-----------

[](#instalation)

```
composer require diasfs/twig-relative-path
```

Initialization
--------------

[](#initialization)

```
use Twig\Extension\RelativePathExtension;
use Twig\Environment;

...

$twig = new Environment($loader);
$twig->addExtension(new RelativePathExtension());
```

Example
-------

[](#example)

```
{# layout.html.twig #}

        ...

        {% block content '' %}

{# pages/inc/form.html.twig #}

    ...

{# pages/page.html.twig #}
{% extends "../layout.html.twig" %}

{% block content %}
    {% include './inc/form.html.twig' %}
{% endblock %}
```

The resulting html will be the following:

```
>

        ...

            ...

```

License
-------

[](#license)

The library is released under the MIT License. See the bundled [LICENSE](LICENSE) file for details.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~430 days

Total

2

Last Release

586d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d721b0374850bd8800cbda2537e464f8a451227930a439a82b2a1eb1ea8e457?d=identicon)[diasfs](/maintainers/diasfs)

---

Top Contributors

[![diasfs](https://avatars.githubusercontent.com/u/1634828?v=4)](https://github.com/diasfs "diasfs (2 commits)")[![6a5p1](https://avatars.githubusercontent.com/u/26039558?v=4)](https://github.com/6a5p1 "6a5p1 (1 commits)")

---

Tags

twigpathrelativepathsextendsinclude

### Embed Badge

![Health badge](/badges/diasfs-twig-relative-path/health.svg)

```
[![Health](https://phpackages.com/badges/diasfs-twig-relative-path/health.svg)](https://phpackages.com/packages/diasfs-twig-relative-path)
```

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M313](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36663.2M218](/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

21946.0M132](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

23018.5M53](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21814.8M161](/packages/symfony-ux-twig-component)

PHPackages © 2026

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