PHPackages                             jmf/twig-type - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. jmf/twig-type

ActiveLibrary[Testing &amp; Quality](/categories/testing)

jmf/twig-type
=============

Twig extension for testing variables type (integer, string, class, etc).

1.0.0(1y ago)02103mitPHPPHP &gt;=8.3

Since Jun 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jmfeurprier/twig-type)[ Packagist](https://packagist.org/packages/jmf/twig-type)[ RSS](/packages/jmf-twig-type/feed)WikiDiscussions 1.0 Synced 1mo ago

READMEChangelogDependencies (7)Versions (2)Used By (3)

Twig extension : type
=====================

[](#twig-extension--type)

Installation &amp; Requirements
-------------------------------

[](#installation--requirements)

Install with [Composer](https://getcomposer.org):

```
composer require jmf/twig-type
```

Usage in Twig templates
-----------------------

[](#usage-in-twig-templates)

### get\_class() filter

[](#get_class-filter)

Returns class of provided object.

```
{% set class = object|get_class %}
```

### get\_type() filter

[](#get_type-filter)

Returns type of provided variable.

```
{% set type = value|get_type %}
```

### "array" test

[](#array-test)

Returns true if provided variable is an array.

```
{% if (value is array) %}
    {# ... #}
{% endif %}
```

### "bool" (boolean) test

[](#bool-boolean-test)

Returns true if provided variable is a boolean.

```
{% if (value is bool) %}
    {# ... #}
{% endif %}
```

### "float" test

[](#float-test)

Returns true if provided variable is a float.

```
{% if (value is float) %}
    {# ... #}
{% endif %}
```

### "int" (integer) test

[](#int-integer-test)

Returns true if provided variable is an integer.

```
{% if (value is int) %}
    {# ... #}
{% endif %}
```

### "numeric" test

[](#numeric-test)

Returns true if provided variable is numeric.

```
{% if (value is numeric) %}
    {# ... #}
{% endif %}
```

### "object" test

[](#object-test)

Returns true if provided variable is an object.

```
{% if (value is object) %}
    {# ... #}
{% endif %}
```

### "scalar" test

[](#scalar-test)

Returns true if provided variable is scalar.

```
{% if (value is scalar) %}
    {# ... #}
{% endif %}
```

### "string" test

[](#string-test)

Returns true if provided variable is a string.

```
{% if (value is string) %}
    {# ... #}
{% endif %}
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

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

Every ~0 days

Total

2

Last Release

712d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b08b8105ec8bc88d1c911e10dbf156814769650a67960e2f3d71ed6d2417f0d?d=identicon)[jmfeurprier](/maintainers/jmfeurprier)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jmf-twig-type/health.svg)

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

###  Alternatives

[fakerino/fakerino

Faker framework, for generate every kind of fake data for test, database seed, mock responses, other

12214.8k5](/packages/fakerino-fakerino)

PHPackages © 2026

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