PHPackages                             prinsfrank/phpstan-doc-code-analyzer - 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. prinsfrank/phpstan-doc-code-analyzer

ActivePhpstan-extension[Utility &amp; Helpers](/categories/utility)

prinsfrank/phpstan-doc-code-analyzer
====================================

Analyze code snippets in documentation and README with PHPStan!

v0.0.3(8mo ago)15.4k↑33.3%1MITPHPPHP ^8.2CI passing

Since Jul 15Pushed 8mo agoCompare

[ Source](https://github.com/PrinsFrank/phpstan-doc-code-analyzer)[ Packagist](https://packagist.org/packages/prinsfrank/phpstan-doc-code-analyzer)[ GitHub Sponsors](https://github.com/PrinsFrank)[ RSS](/packages/prinsfrank-phpstan-doc-code-analyzer/feed)WikiDiscussions main Synced 1mo ago

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

PHPStan Doc Code Analyzer
=========================

[](#phpstan-doc-code-analyzer)

When you have an extensive README.md or a bunch of documentation files, it is sometimes hard to keep all documentation up to date with the actual code. Why not also analyze code blocks in those files with PHPStan?

Getting started
---------------

[](#getting-started)

```
composer require --dev prinsfrank/phpstan-doc-code-analyzer
```

Configuration
-------------

[](#configuration)

### Configuring paths to look for Markdown files

[](#configuring-paths-to-look-for-markdown-files)

You can configure the paths to analyze with glob patterns. By default, these are configured like this:

```
parameters:
    docCodeAnalyzer:
        paths:
            - docs/**.md
            - README.md
```

If one of the glob patterns doesn't match any files, this is likely a misconfiguration, so this will cause an error.

### Auto prepend open tag when missing

[](#auto-prepend-open-tag-when-missing)

When using PHP snippets in your documentation, you might not have all snippets start with the `
