PHPackages                             fromholdio/silverstripe-csshelpers - 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. fromholdio/silverstripe-csshelpers

AbandonedArchivedSilverstripe-vendormodule

fromholdio/silverstripe-csshelpers
==================================

Provides css hooks to add to your template BODY element, generated from user state and current page meta information.

1.0.0(7y ago)0765BSD-3-ClausePHPPHP &gt;=5.6

Since Feb 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/fromholdio/silverstripe-csshelpers)[ Packagist](https://packagist.org/packages/fromholdio/silverstripe-csshelpers)[ Docs](https://github.com/fromholdio/silverstripe-csshelpers)[ RSS](/packages/fromholdio-silverstripe-csshelpers/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

silverstripe-csshelpers
=======================

[](#silverstripe-csshelpers)

Applies an extension to `SiteTree` that provides css hooks for your template, based on user state (logged in/out/etc) and current page meta information (class, class hierarchy, url-segment/route).

Intended as a cheap and easy method of adding sometimes-useful css hooks to your `` element.

Two variables are made available to templates:

- `$BodyCSSClass`
- `$BodyCSSID`

FWIW, the classes generated are based on an aged version of my own blend of BEM ... so, there's that. I'm definitely open to standardising them at some point, or allowing them to be set via static config (somehow?) at some stage.

Requirements
------------

[](#requirements)

SilverStripe 4

Installation
------------

[](#installation)

`composer require fromholdio/silverstripe-csshelpers`

Details
-------

[](#details)

`$BodyCSSID` is generated using the prefix `page-` and the full url-segment of the current page (i.e. it includes the route hierarchy / urlsegment's of parent pages too).

```
Sample $BodyCSSID: "page-blog-article-name"

```

`$BodyCSSClass` is generated using:

- `Body` is added as initial part of return string
- The page's parents are looped, adding `Body--` for each (allowing css-targeting of specific area of site)
- The class hierarchy of the page is looped, adding `class-` for each, stopping at `class-page`
- Current controller action is added: `action-`
- Logged in status is added: `logged-[in|out]`

```
Sample $BodyCSSClass: "Body Body--blog Body--blog--article-name class-blogpost class-page action-index logged-out"
```

Disclaimer
----------

[](#disclaimer)

Yep. Sometimes this kind of targeting with CSS hooks based on URL segments that the user can update in the CMS on a whim (through your fault or theirs 😉), is a hideous and terrible mistake.

But sometimes it's just the right tool for the job in front of you.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Unknown

Total

1

Last Release

2637d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40e135ad117686bee39707c1d9286cc5e915e219c26a10d13858ca44d14f1eb0?d=identicon)[dizzystuff](/maintainers/dizzystuff)

---

Top Contributors

[![dizzystuff](https://avatars.githubusercontent.com/u/576903?v=4)](https://github.com/dizzystuff "dizzystuff (2 commits)")

---

Tags

csssilverstripe

### Embed Badge

![Health badge](/badges/fromholdio-silverstripe-csshelpers/health.svg)

```
[![Health](https://phpackages.com/badges/fromholdio-silverstripe-csshelpers/health.svg)](https://phpackages.com/packages/fromholdio-silverstripe-csshelpers)
```

###  Alternatives

[lekoala/silverstripe-softdelete

Soft delete extension for SilverStripe

11184.4k](/packages/lekoala-silverstripe-softdelete)

PHPackages © 2026

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