PHPackages                             omegacode/jwt-secured-api-twig - 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. omegacode/jwt-secured-api-twig

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

omegacode/jwt-secured-api-twig
==============================

This package integrates the template engine twig into the api frame work.

1.0.1(5y ago)00MITPHP

Since Dec 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/0m3gaC0d3/jwt-secured-api-twig)[ Packagist](https://packagist.org/packages/omegacode/jwt-secured-api-twig)[ Docs](https://github.com/0m3gaC0d3/jwt-secured-api-twig)[ RSS](/packages/omegacode-jwt-secured-api-twig/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (10)Versions (3)Used By (0)

[![alt text](https://camo.githubusercontent.com/ef9fb297fa5dc5e890dd8f780fb3a649789287da6f81be7d758d1664b9862e3e/68747470733a2f2f7472617669732d63692e6f72672f306d336761433064332f6a77742d736563757265642d6170692d747769672e7376673f6272616e63683d6d6173746572 "Build status")](https://camo.githubusercontent.com/ef9fb297fa5dc5e890dd8f780fb3a649789287da6f81be7d758d1664b9862e3e/68747470733a2f2f7472617669732d63692e6f72672f306d336761433064332f6a77742d736563757265642d6170692d747769672e7376673f6272616e63683d6d6173746572)

JWT secured API - Twig
======================

[](#jwt-secured-api---twig)

This package integrates the template engine [twig](https://twig.symfony.com/) into the api frame work.

Use twig in actions
-------------------

[](#use-twig-in-actions)

This package allows you to create actions with twig rendering out of the box. You only have your action class extending `\OmegaCode\JwtSecuredApiTwig\Action\AbstractTwigAction`.

An example could be:

```
namespace Vendor\MyProject\Action;

use OmegaCode\JwtSecuredApiTwig\Action\AbstractTwigAction;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

class IndexAction extends AbstractTwigAction
{
    public function __invoke(Request $request, Response $response): Response
    {
        return $this->render($response, [
            'currentTime' => time(),
        ]);
    }

    protected function getTemplateFilePath(): string
    {
        return 'index.html'; // res/templates/index.html
    }
}
```

Use twig to render
------------------

[](#use-twig-to-render)

To use twig to render a template file, you can simply inject the service `Twig\Environment`. An example on how to use the service can be found in class `\OmegaCode\JwtSecuredApiTwig\Action\AbstractTwigAction`.

Manipulate template directories
-------------------------------

[](#manipulate-template-directories)

Maybe you want to change the default loading directory for twig templates (`res/templates`). This can be archived by creating a subscriber like below.

```
services:
  Vendor\MyProject\Subscriber\TwigTemplateSubscriber:
    tags:
      - 'kernel.event_subscriber'
```

```
namespace Vendor\MyProject\Subscriber;

use OmegaCode\JwtSecuredApiTwig\Event\Twig\CollectTemplatesEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class TwigTemplateSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            CollectTemplatesEvent::NAME => 'onCollectTemplates',
        ];
    }

    public function onCollectTemplates(CollectTemplatesEvent $event): void
    {
        $event->addTemplatePath(APP_ROOT_PATH . '/my/custom/templates');
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

2

Last Release

1951d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ade14253226c95b3fb89aedf9f3338cc985407678ee3781bf97b4dfed57d74d?d=identicon)[Wolf-Peter Utz](/maintainers/Wolf-Peter%20Utz)

---

Top Contributors

[![wolf-utz](https://avatars.githubusercontent.com/u/41939129?v=4)](https://github.com/wolf-utz "wolf-utz (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/omegacode-jwt-secured-api-twig/health.svg)

```
[![Health](https://phpackages.com/badges/omegacode-jwt-secured-api-twig/health.svg)](https://phpackages.com/packages/omegacode-jwt-secured-api-twig)
```

###  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)
