PHPackages                             hexydec/cssdoc - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. hexydec/cssdoc

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

hexydec/cssdoc
==============

A token based CSS Document parser and minifier written in PHP

1.2.3(1mo ago)410.9k↓31.3%31MITPHPPHP &gt;=8.1CI failing

Since Jul 11Pushed 10mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (21)Used By (1)

CSSDoc: PHP CSS Document Parser and Minifier
============================================

[](#cssdoc-php-css-document-parser-and-minifier)

A tokeniser based CSS document parser and minifier, written in PHP.

[![Licence](https://camo.githubusercontent.com/1be08aa7893603196bc3465a2235df43f54fab679741e5cdb07b9f513c5dd5d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d6c69676874677265792e737667)](https://camo.githubusercontent.com/1be08aa7893603196bc3465a2235df43f54fab679741e5cdb07b9f513c5dd5d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d6c69676874677265792e737667)[![Status: Stable](https://camo.githubusercontent.com/af83a8dcabf200b08620cd9f1e69904403bdef64b5962d6ff3126c88446bf9e2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374617475732d537461626c652d477265656e2e737667)](https://camo.githubusercontent.com/af83a8dcabf200b08620cd9f1e69904403bdef64b5962d6ff3126c88446bf9e2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374617475732d537461626c652d477265656e2e737667)[![Tests Status](https://github.com/hexydec/cssdoc/actions/workflows/tests.yml/badge.svg)](https://github.com/hexydec/cssdoc/actions/workflows/tests.yml)[![Code Coverage](https://camo.githubusercontent.com/f10be89adf620f3986e96b9c72c9be97026793b8ecbd12cc670c2e7086094666/68747470733a2f2f636f6465636f762e696f2f67682f686578796465632f637373646f632f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://app.codecov.io/gh/hexydec/cssdoc)

Description
-----------

[](#description)

A CSS parser, primarily designed for minifying CSS documents.

The parser designed around a tokeniser to make the document processing more reliable than regex based minifiers, which are a bit blunt and can be problematic if they match patterns in the wrong places.

Usage
-----

[](#usage)

To minify a CSS document:

```
$doc = new \hexydec\css\cssdoc();

// load from a variable
if ($doc->load($css) {

	// minify the document
	$doc->minify();

	// compile back to CSS
	echo $doc->compile();
}
```

You can test out the minifier online at , or run the supplied index.php file after installation.

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

[](#installation)

The easiest way to get up and running is to use composer:

```
$ composer install hexydec/cssdoc

```

CSSdoc requires [\\hexydec\\token\\tokenise](https://github.com/hexydec/tokenise) to run, which you can install manually if not using composer.

Documentation
-------------

[](#documentation)

- [How it works](docs/how-it-works.md)
- [How to use and examples](docs/how-to-use.md)
- [API Reference](docs/api/readme.md)
- [Object Performance](docs/performance.md)

Support
-------

[](#support)

CSSdoc supports PHP version 8.0+.

Contributing
------------

[](#contributing)

If you find an issue with CSSdoc, please create an issue in the tracker.

If you wish to fix an issues yourself, please fork the code, fix the issue, then create a pull request, and I will evaluate your submission.

Licence
-------

[](#licence)

The MIT License (MIT). Please see [License File](LICENCE) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance69

Regular maintenance activity

Popularity30

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 98.5% 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 ~115 days

Recently: every ~261 days

Total

19

Last Release

55d ago

Major Versions

0.5.3 → 1.0.02022-03-04

PHP version history (4 changes)0.2.0PHP &gt;=7.3

1.0.1PHP &gt;=7.4

1.1.1PHP &gt;=8.0

1.2.3PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5257ffcb9e543c03368e1090d353092b40b1491d15cd3126d14d3d32975b6384?d=identicon)[hexydec](/maintainers/hexydec)

---

Top Contributors

[![hexydec](https://avatars.githubusercontent.com/u/743478?v=4)](https://github.com/hexydec "hexydec (200 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![insign](https://avatars.githubusercontent.com/u/1113045?v=4)](https://github.com/insign "insign (1 commits)")

---

Tags

css-minify-minifier-parser-phpparsercssminifyminifierstylesheetcompiler

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hexydec-cssdoc/health.svg)

```
[![Health](https://phpackages.com/badges/hexydec-cssdoc/health.svg)](https://phpackages.com/packages/hexydec-cssdoc)
```

###  Alternatives

[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[hexydec/htmldoc

A token based HTML document parser and minifier. Minify HTML documents including inline CSS, Javascript, and SVG's on the fly. Extract document text, attributes, and fragments. Full test suite.

2610.3k3](/packages/hexydec-htmldoc)[scotteh/php-dom-wrapper

Simple DOM wrapper to select nodes using either CSS or XPath expressions and manipulate results quickly and easily.

1471.9M10](/packages/scotteh-php-dom-wrapper)[mishal/iless

Less.js port to PHP

4737.0k3](/packages/mishal-iless)[ffi/preprocessor

Simple C Preprocessor

2637.0k13](/packages/ffi-preprocessor)[smuuf/php-peg

PEG parser generator for PHP.

12118.4k3](/packages/smuuf-php-peg)

PHPackages © 2026

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