PHPackages                             silverstripe/markdown-php-codesniffer - 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. silverstripe/markdown-php-codesniffer

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

silverstripe/markdown-php-codesniffer
=====================================

A wrapper around squizlabs/PHP\_CodeSniffer which lets you lint PHP fenced code blocks in markdown files

1.0.4(1y ago)195.7k↓20%2[1 issues](https://github.com/silverstripe/markdown-php-codesniffer/issues)1BSD-3-ClausePHPPHP ^8.0CI passing

Since Nov 13Pushed 1y ago6 watchersCompare

[ Source](https://github.com/silverstripe/markdown-php-codesniffer)[ Packagist](https://packagist.org/packages/silverstripe/markdown-php-codesniffer)[ RSS](/packages/silverstripe-markdown-php-codesniffer/feed)WikiDiscussions 1 Synced 2w ago

READMEChangelog (5)Dependencies (3)Versions (7)Used By (1)

Markdown PHP Codesniffer
========================

[](#markdown-php-codesniffer)

A wrapper around [`squizlabs/PHP_CodeSniffer`](https://github.com/squizlabs/PHP_CodeSniffer) which lets you lint PHP fenced code blocks in markdown files.

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

[](#installation)

Unlike `squizlabs/PHP_CodeSniffer`, this isn't intended to be installed globally - you should install it as a dev dependency of your project.

```
composer require --dev silverstripe/markdown-php-codesniffer
```

Usage
-----

[](#usage)

To sniff markdown files, run `mdphpcs` from the vendor bin directory:

```
# sniff a directory
vendor/bin/mdphpcs /path/to/docs

# sniff a specific file
vendor/bin/mdphpcs /path/to/docs/file.md
```

Most of the options available with the `phpcs` and `phpcbf` commands from `squizlabs/PHP_CodeSniffer` are available with `mdphpcs` as well. See [PHP\_CodeSniffer usage](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage) for more details.

### Fixing violations automatically

[](#fixing-violations-automatically)

Some violations can be fixed automatically, and PHP\_CodeSniffer will include information about those in the CLI output. To fix them, simply pass the `--fix` option to `mdphpcs`:

```
vendor/bin/mdphpcs /path/to/docs --fix
```

This is the equivalent of using the `phpcbf` command on regular PHP files.

### Linting other languages

[](#linting-other-languages)

`squizlabs/PHP_CodeSniffer` supports linting some languages other than PHP. Theoretically that can be done with this tool as well. You'll need to pass the language (as it's written in the markdown language hint) in with the `--linting-language` option.

```
vendor/bin/mdphpcs /path/to/docs --linting-language=JS
```

### Linting rules

[](#linting-rules)

If you have a [default configuration file](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file) or explicitly pass in a standard using the `--standard` option, those rules will be used for linting - but be aware that some rules won't be appropriate for linting code blocks.

For example, the `PSR12.Files.FileHeader.HeaderPosition` rule will always fail linting, because we need to include empty lines prior to the content of the code block in the content we pass to `squizlabs/PHP_CodeSniffer` so it can correctly report the line of each violation in the original markdown file.

If you don't specify a standard and have no default configuration file, the default configuration [included in this package](./phpcs.default.xml) will be used. This configuration is based on PSR12, with some exclusions that make it appropriate for use in linting code blocks.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance21

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~93 days

Total

7

Last Release

421d ago

PHP version history (2 changes)1.0.0PHP ^8.0

1.x-devPHP ^8.1

### Community

Maintainers

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

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

![](https://www.gravatar.com/avatar/afbb3dcc9ef29c1a6eedd6addcae5fce9ab1271915a85a4c349301b71237368d?d=identicon)[silverstripe-machine01](/maintainers/silverstripe-machine01)

![](https://avatars.githubusercontent.com/u/1168676?v=4)[Maxime Rainville](/maintainers/maxime-rainville)[@maxime-rainville](https://github.com/maxime-rainville)

---

Top Contributors

[![ChloeSartorelli](https://avatars.githubusercontent.com/u/36352093?v=4)](https://github.com/ChloeSartorelli "ChloeSartorelli (25 commits)")[![GuySartorelli](https://avatars.githubusercontent.com/u/36352093?v=4)](https://github.com/GuySartorelli "GuySartorelli (25 commits)")[![emteknetnz](https://avatars.githubusercontent.com/u/4809037?v=4)](https://github.com/emteknetnz "emteknetnz (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

standardsphpcsmarkdowncodesniffersniffer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silverstripe-markdown-php-codesniffer/health.svg)

```
[![Health](https://phpackages.com/badges/silverstripe-markdown-php-codesniffer/health.svg)](https://phpackages.com/packages/silverstripe-markdown-php-codesniffer)
```

###  Alternatives

[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

601180.6M2.7k](/packages/dealerdirect-phpcodesniffer-composer-installer)[slevomat/coding-standard

Slevomat Coding Standard for PHP\_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.

1.5k137.8M2.5k](/packages/slevomat-coding-standard)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.6k10](/packages/helsingborg-stad-municipio)[daux/daux.io

Documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly

828201.8k1](/packages/daux-dauxio)[spryker/code-sniffer

Spryker Code Sniffer Standards

384.3M2.9k](/packages/spryker-code-sniffer)

PHPackages © 2026

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