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 11y 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 today

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 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

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

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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