PHPackages                             cerdic/css-tidy - 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. cerdic/css-tidy

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

cerdic/css-tidy
===============

CSSTidy is a CSS minifier

v2.2.1(1y ago)2092.0M—6.8%62[2 issues](https://github.com/Cerdic/CSSTidy/issues)[3 PRs](https://github.com/Cerdic/CSSTidy/pulls)6LGPL-2.1-or-laterPHPPHP ^7.1 || ^8CI passing

Since Mar 13Pushed 1y ago20 watchersCompare

[ Source](https://github.com/Cerdic/CSSTidy)[ Packagist](https://packagist.org/packages/cerdic/css-tidy)[ RSS](/packages/cerdic-css-tidy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (28)Used By (6)

CSSTidy
=======

[](#csstidy)

CSSTidy is a CSS minifier

- css\_optimiser.php is the web-interface
- class.csstidy.php is the parser
- bin/pcsstidy is the standalone command line executable

This class represents a CSS parser which reads CSS code and saves it in an array. In opposite to most other CSS parsers, it does not use regular expressions and thus has full CSS3 support and a higher reliability. The downside of not using regular expressions is a lower speed though. Additional to that it applies some optimisations and fixes to the CSS code.

Usage
-----

[](#usage)

```
include('class.csstidy.php');
$csstidy = new csstidy();

// Set some options :
$csstidy->set_cfg('optimise_shorthands', 2);
$csstidy->set_cfg('template', 'high');

// Parse the CSS
$csstidy->parse($css_code);

// Get back the optimized CSS Code
$css_code_opt = $csstidy->print->plain();
```

Changelog
---------

[](#changelog)

- v2.2.0 :
    - test suite switch to phpunit
- v2.1.0 :
    - fix issues with css4 colors
- v2.0.0 :
    - PHP 7.1 is the minimal version. Compatible PHP 8.0 and 8.1
- v1.7.3 :
    - fix bug and notice on reverse\_left\_and\_right option
- v1.7.1 :
    - fix deprecated with PHP 7.4
- v1.7.0 :
    - provide bin/pcsstidy for command line usage
    - support nested @media and @supports rules
- v1.6.5 :
    - fix warnings with PHP 7.3
- v1.6.4 :
    - preserve important comments (starting with !) in the minification `/*! Credits/Licence */`
- v1.6.3 :
    - border-radius shorthands optimisation, reverse\_left\_and\_right option
- v1.5.7 :
    - PHP 7 compatibility, composer update, Travis CI integration
- v1.5.6 :
    - fixes minor bugs, mainly on CSS3 properties/units
- v1.5.2 :
    - is PHP 5.4+ compliant, removes use of GLOBALS, fixes some bugs, integrates CSS3 units
    - and now available on
- v1.4 :
    - Is the new version coming from master branch (corresponds to the initial trunk of svn repository) after beeing stabilized
- v1.3 branch corresponds to the last stable relase published by the author.
    - It integrates some bugfixes and a 1.3.1 version has been taged
    - Since the original project () has been suspended here is the import of  on 2010-11-14

Only PHP version is here maintained

Licence
-------

[](#licence)

> Copyright 2005-2007 Florian Schmitz Copyright 2010-2019 Cedric Morin
>
> CSSTidy is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
>
> CSSTidy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
>
> You should have received a copy of the GNU Lesser General Public License along with this program. If not, see .

History
-------

[](#history)

Original Tracker : [http://sourceforge.net/tracker/?group\_id=148404&amp;atid=771415](http://sourceforge.net/tracker/?group_id=148404&atid=771415)

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity59

Moderate usage in the ecosystem

Community37

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 70.1% 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 ~162 days

Recently: every ~199 days

Total

25

Last Release

546d ago

Major Versions

v1.x-dev → v2.0.02022-01-10

PHP version history (2 changes)v1.7.0PHP ^5.4.0 || ^7

v2.0.0PHP ^7.1 || ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/67cd398fd8b3fb3e756fe20dcc85bed5db3bc417ed0529932dd6befa9371fd06?d=identicon)[greg0ire](/maintainers/greg0ire)

![](https://www.gravatar.com/avatar/dd4962c257035baf14bdcb6451b8f4dba99da3948dd83359ae88129b24315e06?d=identicon)[Cerdic](/maintainers/Cerdic)

---

Top Contributors

[![Cerdic](https://avatars.githubusercontent.com/u/342805?v=4)](https://github.com/Cerdic "Cerdic (150 commits)")[![cfinke](https://avatars.githubusercontent.com/u/435369?v=4)](https://github.com/cfinke "cfinke (20 commits)")[![JamesRezo](https://avatars.githubusercontent.com/u/6839893?v=4)](https://github.com/JamesRezo "JamesRezo (14 commits)")[![Need4Video](https://avatars.githubusercontent.com/u/2139630?v=4)](https://github.com/Need4Video "Need4Video (7 commits)")[![jaydiablo](https://avatars.githubusercontent.com/u/136907?v=4)](https://github.com/jaydiablo "jaydiablo (5 commits)")[![marcimat](https://avatars.githubusercontent.com/u/355431?v=4)](https://github.com/marcimat "marcimat (3 commits)")[![weikinhuang](https://avatars.githubusercontent.com/u/794658?v=4)](https://github.com/weikinhuang "weikinhuang (2 commits)")[![amiga-500](https://avatars.githubusercontent.com/u/5191497?v=4)](https://github.com/amiga-500 "amiga-500 (2 commits)")[![flug](https://avatars.githubusercontent.com/u/1810304?v=4)](https://github.com/flug "flug (1 commits)")[![claviska](https://avatars.githubusercontent.com/u/55639?v=4)](https://github.com/claviska "claviska (1 commits)")[![ChristophWurst](https://avatars.githubusercontent.com/u/1374172?v=4)](https://github.com/ChristophWurst "ChristophWurst (1 commits)")[![bytestream](https://avatars.githubusercontent.com/u/1788397?v=4)](https://github.com/bytestream "bytestream (1 commits)")[![azettl](https://avatars.githubusercontent.com/u/644570?v=4)](https://github.com/azettl "azettl (1 commits)")[![nuxodin](https://avatars.githubusercontent.com/u/16326?v=4)](https://github.com/nuxodin "nuxodin (1 commits)")[![phenix-factory](https://avatars.githubusercontent.com/u/1810149?v=4)](https://github.com/phenix-factory "phenix-factory (1 commits)")[![PHPGangsta](https://avatars.githubusercontent.com/u/608408?v=4)](https://github.com/PHPGangsta "PHPGangsta (1 commits)")[![RicherYang](https://avatars.githubusercontent.com/u/3900767?v=4)](https://github.com/RicherYang "RicherYang (1 commits)")[![SunflowerFuchs](https://avatars.githubusercontent.com/u/18332886?v=4)](https://github.com/SunflowerFuchs "SunflowerFuchs (1 commits)")[![dsferruzza](https://avatars.githubusercontent.com/u/1931963?v=4)](https://github.com/dsferruzza "dsferruzza (1 commits)")

---

Tags

cssminifiertidy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cerdic-css-tidy/health.svg)

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

###  Alternatives

[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k30.5M336](/packages/matthiasmullie-minify)[tedivm/jshrink

Javascript Minifier built in PHP

76037.7M139](/packages/tedivm-jshrink)[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[mexitek/phpcolors

A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.

5003.6M18](/packages/mexitek-phpcolors)[wikimedia/less.php

PHP port of the LESS processor

12327.4M77](/packages/wikimedia-lessphp)[sensiolabs/minify-bundle

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

5694.9k1](/packages/sensiolabs-minify-bundle)

PHPackages © 2026

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