PHPackages                             jandc/critical-css - 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. jandc/critical-css

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jandc/critical-css
==================

Package wrapper and twig postprocessor class which uses the 'css from html extractor' library and twigwrapper to inject a document's head with critical css

0.6.1(8y ago)3711.6k2[4 issues](https://github.com/JanDC/critical-css/issues)1MITPHP

Since Nov 23Pushed 8y ago4 watchersCompare

[ Source](https://github.com/JanDC/critical-css)[ Packagist](https://packagist.org/packages/jandc/critical-css)[ RSS](/packages/jandc-critical-css/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (20)Used By (1)

Critical CSS
============

[](#critical-css)

PHP library for generating critical CSS.

[![critical css banner](https://camo.githubusercontent.com/7c6e5f664d9e594fe3b769d70c1825a683e7ecce64b5e35439a516e72516654e/68747470733a2f2f637269746963616c2d6373732e6a616e64632e696f2f696d616765732f62616e6e65722e6a7067)](https://camo.githubusercontent.com/7c6e5f664d9e594fe3b769d70c1825a683e7ecce64b5e35439a516e72516654e/68747470733a2f2f637269746963616c2d6373732e6a616e64632e696f2f696d616765732f62616e6e65722e6a7067)

Features
--------

[](#features)

- PHP only, no Node.js required.
- Automatically generated for each page
- Manual control through `{% fold %}{% endfold %}` tags
- Dynamically resolves CSS used on each page

Site(s) using Critical CSS
--------------------------

[](#sites-using-critical-css)

-

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

[](#installation)

`composer require jandc/critical-css `

##### Register the twig extension and create a wrapper instance with the critical CSS processor

[](#register-the-twig-extension-and-create-a-wrapper-instance-with-the-critical-css-processor)

```
 use TwigWrapper\TwigWrapper;
 use CriticalCssProcessor\CriticalCssProcessor;

 $twigEnvironment->addExtension(new CSSFromHTMLExtractor\Twig\Extension());
 $twigWrapper = new TwigWrapper($twigEnvironment, [new CriticalCssProcessor()]);
```

##### Mark the regions of your templates with the provided blocks

[](#mark-the-regions-of-your-templates-with-the-provided-blocks)

```
{% fold %}

    ...

{% endfold %}
```

##### Render your pages, using the twigwrapper

[](#render-your-pages-using-the-twigwrapper)

```
 $twigWrapper->render('@templates/my/template.twig', ['foo'=>'bar']);
```

Available implementations
-------------------------

[](#available-implementations)

- [Silex](https://github.com/JanDC/critical-css-silex)

If you have your own implementation, please send a pull request to add it to this list.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 83.8% 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 ~26 days

Recently: every ~13 days

Total

19

Last Release

3043d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3265146?v=4)[Jan Decavele](/maintainers/jandc)[@JanDC](https://github.com/JanDC)

---

Top Contributors

[![JanDC](https://avatars.githubusercontent.com/u/3265146?v=4)](https://github.com/JanDC "JanDC (31 commits)")[![gijsroge](https://avatars.githubusercontent.com/u/2242498?v=4)](https://github.com/gijsroge "gijsroge (6 commits)")

### Embed Badge

![Health badge](/badges/jandc-critical-css/health.svg)

```
[![Health](https://phpackages.com/badges/jandc-critical-css/health.svg)](https://phpackages.com/packages/jandc-critical-css)
```

###  Alternatives

[roundcube/roundcubemail

The Roundcube Webmail suite

7.1k2.4k3](/packages/roundcube-roundcubemail)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[akeneo/pim-community-dev

Akeneo PIM, the future of catalog management is open!

1.0k624.1k86](/packages/akeneo-pim-community-dev)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M415](/packages/drupal-core-recommended)[code16/sharp

Laravel Content Management Framework

79164.7k8](/packages/code16-sharp)[metamodels/core

MetaModels core

10156.4k68](/packages/metamodels-core)

PHPackages © 2026

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