PHPackages                             hostnet/css-sniffer - 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. hostnet/css-sniffer

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

hostnet/css-sniffer
===================

CSS sniffer

2.4.0(7y ago)1010.7k2MITPHPPHP &gt;=7.1

Since Aug 3Pushed 6y ago5 watchersCompare

[ Source](https://github.com/hostnet/css-sniffer)[ Packagist](https://packagist.org/packages/hostnet/css-sniffer)[ RSS](/packages/hostnet-css-sniffer/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (4)Versions (33)Used By (0)

**IMPORTANT:** Due to internal changes this repository will no longer be maintained. If you are using this, or have plans to use this, please consider an alternative like .

---

[ ![](https://camo.githubusercontent.com/6a25649d6782916f44c023c179b7d1822b6005755f4309c3f0f2368a0038ef06/68747470733a2f2f7777772e686f73746e65742e6e6c2f696d616765732f686f73746e65742e737667)](http://www.hostnet.nl)

The CSS sniffer is build to help improve (and maintain) a consistent code style in CSS and LESS files. It will reduce time figure out another style by enforcing rules. So no longer worrying about tabs vs. spaces, single vs. double quotes or 3 of 6 hex values for colors.

The tool is pretty straight forward, simply run it with the file you would like to inspect. So if you have a css file like so:

```
.good { background-image: url("/foo.com"); }
.bad { background-image: url('/foo.com'); }
```

Simply run the tool and you will get the following output.

```
$ vendor/bin/css-sniff sniff quotes.less

FILE: test/Sniff/fixtures/quotes.less
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 2 | Text should use " as quotes.
--------------------------------------------------------------------------------

```

> Some builtin sniffs are pretty opinionated. If you disagree you have two options: open an issue to change the current behavior or write your own sniff.

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

[](#installation)

**Using phar (recommended)**

Download the phar that is attached to the [latest release of the sniffer](https://github.com/hostnet/css-sniffer/releases).

**Using composer**

- `$ composer require --dev hostnet/css-sniffer`
- This library follows [semantic versioning](http://semver.org/) strictly.

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

[](#documentation)

Basic usuage is as follows:

```
$ vendor/bin/css-sniff --help
Usage:
  sniff [options] [--] []...

Arguments:
  files                      Input file

Options:
      --format[=FORMAT]      Type of output format, default: console [default: "console"]
  -s, --standard[=STANDARD]  Code Standard to use, by default the Hostnet standard is used. This is the path to the xml file.
      --stdin                If given, this option will tell the sniffer to check the STDIN for input.
  -p, --pretty               Pretty format output
      --no-exit-code         Always return 0 as exit code, regardless of the result
  -h, --help                 Display this help message
  -q, --quiet                Do not output any message
  -V, --version              Display this application version
      --ansi                 Force ANSI output
      --no-ansi              Disable ANSI output
  -n, --no-interaction       Do not ask any interactive question
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  Sniffs the given input file and returns the result.

```

*Examples*:

- `vendor/bin/css-sniff`
- `vendor/bin/css-sniff sniff some/file.css`
- `vendor/bin/css-sniff sniff --format=json -p some/file.css`
- `cat some/file.css | vendor/bin/css-sniff sniff --stdin`

### Sniffing for CI

[](#sniffing-for-ci)

The primary focus of the sniffer is to integrate with any CI tooling. For this, it is recommended to add a `csssniff.xml.dist` to your project root. This will allow you to configure which files and directories to process when running the sniffer. A common example would be:

```

    ./app/styles

```

This would process the `app/styles` folder relative from the project root using the `Hostnet` standard. For more information about the xml structure, see [the ruleset configuration documentation](RULESETS.md).

### Output formatting

[](#output-formatting)

Multiple output formats are supported. For now there is `console` (the default), `checkstyle` and `json`. The `json` output looks as follows:

```
$ vendor/bin/css-sniff sniff --format=json -p test/Sniff/fixtures/quotes.less
{
    "totals": {
        "errors": 0
    },
    "files": {
        "test\/Sniff\/fixtures\/quotes.less": {
            "errors": 3,
            "messages": [
                {
                    "message": "One statements found and should be on one line.",
                    "source": "Hostnet\\Component\\CssSniff\\Sniff\\CurlySniff",
                    "line": 1,
                    "column": 7
                },
                {
                    "message": "One statements found and should be on one line.",
                    "source": "Hostnet\\Component\\CssSniff\\Sniff\\CurlySniff",
                    "line": 4,
                    "column": 6
                },
                {
                    "message": "Text should use \" as quotes.",
                    "source": "Hostnet\\Component\\CssSniff\\Sniff\\QuoteTypeSniff",
                    "line": 5,
                    "column": 27
                }
            ]
        }
    }
}

```

> The `-p` is only a pretty format, this is optional but more readable.

### `STDIN` input

[](#stdin-input)

The sniffer can also read from the `STDIN`. This can be usefull when intergrating the tool in an IDE where you might not have a file but want to pass the contents of an editor. Make sure to add the `--stdin` to tell the sniffer to read the `STDIN`. You can also pass a file to allows for you matching rules to work.

```
$ cat test/Sniff/fixtures/quotes.less | vendor/bin/css-sniff sniff --format=json -p --stdin test/Sniff/fixtures/quotes.less
{
    "totals": {
        "errors": 0
    },
    "files": {
        "test\/Sniff\/fixtures\/quotes.less": {
            "errors": 3,
            "messages": [
                {
                    "message": "One statements found and should be on one line.",
                    "source": "Hostnet\\Component\\CssSniff\\Sniff\\CurlySniff",
                    "line": 1,
                    "column": 7
                },
                {
                    "message": "One statements found and should be on one line.",
                    "source": "Hostnet\\Component\\CssSniff\\Sniff\\CurlySniff",
                    "line": 4,
                    "column": 6
                },
                {
                    "message": "Text should use \" as quotes.",
                    "source": "Hostnet\\Component\\CssSniff\\Sniff\\QuoteTypeSniff",
                    "line": 5,
                    "column": 27
                }
            ]
        }
    }
}

```

License
-------

[](#license)

The `hostnet/css-sniffer` is licensed under the [MIT License](https://github.com/hostnet/css-sniffer/blob/master/LICENSE), meaning you can reuse the code within proprietary software provided that all copies of the licensed software include a copy of the MIT License terms and the copyright notice.

Get in touch
------------

[](#get-in-touch)

- Our primary contact channel is via IRC: [freenode.net#hostnet](http://webchat.freenode.net/?channels=%23hostnet).
- Or via our email: .

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 89.2% 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 ~10 days

Recently: every ~30 days

Total

32

Last Release

2878d ago

Major Versions

1.x-dev → 2.0.02017-11-02

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5468127?v=4)[Yannick de Lange](/maintainers/yannickl88)[@yannickl88](https://github.com/yannickl88)

![](https://www.gravatar.com/avatar/65433e1ef6edb2e8f96e18614b6618c84eed20ad0de6de0d0da36a9032ec7a18?d=identicon)[hostnet](/maintainers/hostnet)

---

Top Contributors

[![yannickl88](https://avatars.githubusercontent.com/u/5468127?v=4)](https://github.com/yannickl88 "yannickl88 (66 commits)")[![linaori](https://avatars.githubusercontent.com/u/1754678?v=4)](https://github.com/linaori "linaori (4 commits)")[![ping-localhost](https://avatars.githubusercontent.com/u/37925797?v=4)](https://github.com/ping-localhost "ping-localhost (2 commits)")[![jesse-hostnet](https://avatars.githubusercontent.com/u/45069570?v=4)](https://github.com/jesse-hostnet "jesse-hostnet (1 commits)")[![nutama](https://avatars.githubusercontent.com/u/9001392?v=4)](https://github.com/nutama "nutama (1 commits)")

---

Tags

codestylecsslesslintersniffer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hostnet-css-sniffer/health.svg)

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

###  Alternatives

[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

4743.5k10](/packages/phel-lang-phel-lang)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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