PHPackages                             souldigital/silverstripe-headjs - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. souldigital/silverstripe-headjs

ActiveSilverstripe-module[Utility &amp; Helpers](/categories/utility)

souldigital/silverstripe-headjs
===============================

Use headjs to load requirements in Silverstripe

1.0.2(10y ago)09162[3 PRs](https://github.com/souldigital/silverstripe-headjs/pulls)BSD-3-ClauseJavaScript

Since Jul 29Pushed 10y ago5 watchersCompare

[ Source](https://github.com/souldigital/silverstripe-headjs)[ Packagist](https://packagist.org/packages/souldigital/silverstripe-headjs)[ RSS](/packages/souldigital-silverstripe-headjs/feed)WikiDiscussions master Synced 1mo ago

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

\#Silverstripe HeadJS Backend
=============================

[](#silverstripe-headjs-backend)

Use HeadJS for assets loading.

\##Compatibility
================

[](#compatibility)

Tested with Silverstripe 3.1

\##Features
===========

[](#features)

- Async loading of requirements using the native Requirements engine
- Specific targeting of requirement locations in DOM via SectionedHeadJsBackend
- Critical js/css files to be required in the head while all other requirements are loaded above the closing body
- Add JS callbacks to requirements
- Add dependencies to JS / CSS files

\##How do I use this thing?
===========================

[](#how-do-i-use-this-thing)

\###Setup If you just want to use the HeadJS integration for your Requirements backend, add the following to your `mysite/_config.php`

`Requirements::set_backend(Injector::inst()->get("HeadJsBackend"));`

If you'd like to use the Sectioned Head JS, add the following to your `mysite/_config.php`

`Requirements::set_backend(Injector::inst()->get("SectionedHeadJsBackend"));`

\###Adding a callback An example of adding a callback to a CSS or JS requirement is below:

```
$custom_js = add_to_section("framework/thirdparty/jquery/jquery.js", SectionedHeadJsBackend::SECTION_AFTER_BODY_OPEN);
}

```

\###Super-specific bugs and their associated fixes

\####UserForms module validation won't work (it says it can't find jQuery) There are lots of different ways we can solve this issue, but the simplest one I've found is if you add an extension to the UserDefinedForm\_Controller - or even just edit Page\_Controller - and add the following to the init() function:

```
class UserDefinedFormHeadJSExtension extends Extension {
    public function afterGenerateConditionalJavascript(){
        if(method_exists(Requirements::backend(), "add_dependency")){
            Requirements::backend()->add_dependency("UserFormsConditional", USERFORMS_DIR . '/javascript/UserForm.js');
        }
    }
}

```

\##Maintainer Tim -

\##Original Repo [silverstripe-headjs](https://github.com/lekoala/silverstripe-headjs) by the awesome [lekoala](https://github.com/lekoala)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

3

Last Release

3870d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1dbb5c4276be1d6541ec0fc0fe49071b2fbb60ba153aa706a6c35c1984f69713?d=identicon)[tim-lar](/maintainers/tim-lar)

---

Top Contributors

[![lekoala](https://avatars.githubusercontent.com/u/250762?v=4)](https://github.com/lekoala "lekoala (6 commits)")

---

Tags

silverstripecmsmoduleheadjs

### Embed Badge

![Health badge](/badges/souldigital-silverstripe-headjs/health.svg)

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

PHPackages © 2026

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