PHPackages                             jswhetstone/twig-extension - 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. jswhetstone/twig-extension

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

jswhetstone/twig-extension
==========================

A Twig extension providing convenience methods for context-specific HTML classes.

02.4k2PHP

Since Jun 18Pushed 12y ago1 watchersCompare

[ Source](https://github.com/jswhetstone/twig-extension)[ Packagist](https://packagist.org/packages/jswhetstone/twig-extension)[ RSS](/packages/jswhetstone-twig-extension/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (2)

jswhetstone/twig-extension
==========================

[](#jswhetstonetwig-extension)

Some useful Twig functions for context-relevant class rendering.

`{{ getActiveClass('/some/page') }}`

> Will return 'active' (without quotes) if the current URI contains the string specified. Good for rendering the active state on Bootstrap nav elements. Pass an empty string '' to check for root.

`{{ getPageClasses() }}`

> Will return a class-ready string representation of the current URI. Each directory in the hierarchy is represented by a separate class. The root directory will return 'home' (without quotes).

license
-------

[](#license)

This code is licensed under [WTFPL](http://wtfpl.net)

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5463011?v=4)[J. S. Whetstone](/maintainers/jswhetstone)[@jswhetstone](https://github.com/jswhetstone)

### Embed Badge

![Health badge](/badges/jswhetstone-twig-extension/health.svg)

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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