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.1(1mo ago)03093mitPHPPHP ^8.3CI failing

Since Jun 5Pushed 1mo 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 today

READMEChangelogDependencies (14)Versions (3)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

47

—

FairBetter than 93% of packages

Maintenance93

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity57

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 ~362 days

Total

3

Last Release

34d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.3

1.0.1PHP ^8.3

### 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 (3 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

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)

PHPackages © 2026

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