PHPackages                             falconchen/slim-twig-csrf-inputs - 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. falconchen/slim-twig-csrf-inputs

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

falconchen/slim-twig-csrf-inputs
================================

A slim twig template extension for easy appending the hidden csrf inputs fields

v1.0.4(6y ago)09GPL-2.0+PHPPHP &gt;=5.5.0

Since Jun 25Pushed 6y agoCompare

[ Source](https://github.com/falconchen/slim-twig-csrf-inputs)[ Packagist](https://packagist.org/packages/falconchen/slim-twig-csrf-inputs)[ RSS](/packages/falconchen-slim-twig-csrf-inputs/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (6)Used By (0)

slim twig view csrf inputs
==========================

[](#slim-twig-view-csrf-inputs)

A slim twig template extension for easy appending the hidden csrf inputs fields.

### usage:

[](#usage)

load the extension in the `dependecies.php`, also need to load `\Slim\Csrf\Guard` into dependecies.

```
...
// Load Twig
$container['view'] = function ($c) {
    $settings = $c->get('settings');
    $view = new \Slim\Views\Twig($settings['view']['template_path'], $settings['view']['twig']);

    // Add extensions
    $view->addExtension(new Slim\Views\TwigExtension($c->get('router'), $c->get('request')->getUri()));
    $view->addExtension(new Twig_Extension_Debug());
    // add the twig csrf inputs here
    $view->addExtension(new FalconChen\Slim\Views\TwigExtension\CsrfInputs($c->csrf));

    return $view;
};

//need to load csrf
$container['csrf'] = function ($c) {
    $guard = new \Slim\Csrf\Guard();
    $guard->setFailureCallable(function ($request, $response, $next) {
        $request = $request->withAttribute("csrf_status", false);
        return $next($request, $response);
    });
    return $guard;
};
...

```

then in twig templates , call the `csrf_inputs()` function.

```

{{ csrf_inputs() }}
...

```

output :

```

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

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

Every ~0 days

Total

5

Last Release

2511d ago

### Community

Maintainers

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

---

Top Contributors

[![falconchen](https://avatars.githubusercontent.com/u/981375?v=4)](https://github.com/falconchen "falconchen (3 commits)")

---

Tags

twigslimextensioncsrf

### Embed Badge

![Health badge](/badges/falconchen-slim-twig-csrf-inputs/health.svg)

```
[![Health](https://phpackages.com/badges/falconchen-slim-twig-csrf-inputs/health.svg)](https://phpackages.com/packages/falconchen-slim-twig-csrf-inputs)
```

###  Alternatives

[redant/twig-components

Define reusable components in Twig.

3819.8k1](/packages/redant-twig-components)

PHPackages © 2026

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