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 2d 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 25% 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

3841.2M](/packages/limenius-react-bundle)[pdewit/nova-external-url

An external URL Laravel Nova field.

30383.2k](/packages/pdewit-nova-external-url)[wbrowar/guide

A CMS Guide for Craft CMS.

6154.7k1](/packages/wbrowar-guide)[localgovdrupal/localgov_base

The base theme for LocalGov Drupal websites.

13126.9k5](/packages/localgovdrupal-localgov-base)

PHPackages © 2026

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