PHPackages                             rookie0/twig-infer - 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. rookie0/twig-infer

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

rookie0/twig-infer
==================

Twig template variables infer

v1.0.0(6y ago)03.7k↓50%1MITPHP

Since Jan 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/rookie0/twig-infer)[ Packagist](https://packagist.org/packages/rookie0/twig-infer)[ RSS](/packages/rookie0-twig-infer/feed)WikiDiscussions master Synced 1mo ago

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

Twig-Infer
==========

[](#twig-infer)

Infer twig template variables.

```
$template =  $template]));
$infer = new Infer($twig);

$vars = $infer->variables('template');

// dump $vars
[
    "a_variable" => [],
    "foo"        => [
        "bar"      => [],
        "data-foo" => [],
    ],
    "name"       => [],
    "post"       => [
        "status" => [],
    ],
    "list"       => [],
    "navigation" => [
        [
            "href"    => [],
            "caption" => [],
        ],
    ],
    "users"      => [
        [
            "username" => [],
            "roles"    => [
                [
                    "name"        => [],
                    "slug"        => [],
                    "permissions" => [
                        [
                            "method" => [],
                            "path"   => [],
                        ],
                    ],
                ],
            ],
        ],
    ],
    "actions"    => [
        [
            "url"  => [],
            "name" => [],
        ],
    ],
]
```

The output array keys are the template variables, and the value show the variable structure and usage:

- Empty array meaning simple variable just to display
- Associative array meaning array or object to display the keys or properties
- Numeric array meaning an array to loop

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

[](#installation)

`composer require rookie0/twig-infer`

License
-------

[](#license)

[MIT](./LICENSE)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

2316d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c4a9e7ad6ec6865ba80b35a0430b6ec18f504a416c29a22508629546cfaa084?d=identicon)[rookie0](/maintainers/rookie0)

---

Top Contributors

[![rookie0](https://avatars.githubusercontent.com/u/5813232?v=4)](https://github.com/rookie0 "rookie0 (2 commits)")

---

Tags

templatetwigvariablestwigtemplatevariablesinfer

### Embed Badge

![Health badge](/badges/rookie0-twig-infer/health.svg)

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

###  Alternatives

[wyrihaximus/twig-view

Twig powered View for CakePHP

804.7M1](/packages/wyrihaximus-twig-view)[oro/twig-inspector

Oro Twig Inspector adds the possibility to find twig templates and blocks used for rendering HTML pages faster during development

47532.6k14](/packages/oro-twig-inspector)[shapecode/twig-template-event-bundle

Possibility to add code in a twig template dynamically

1010.7k](/packages/shapecode-twig-template-event-bundle)

PHPackages © 2026

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