Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpstan Doc Code Analyzer Laravel Package

prinsfrank/phpstan-doc-code-analyzer

Analyze and validate PHP code examples in your documentation using PHPStan. This package scans doc blocks and docs for code snippets, runs static analysis, and helps catch outdated or incorrect examples early in CI.

View on GitHub
Deep Wiki
Context7

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

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

Configuration

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

When using PHP snippets in your documentation, you might not have all snippets start with the <?php open tag. So Instead of:

```php
<?php

echo 123;

You might start your code blocks without that open tag:

```php
echo 123;

In that case this extension will automatically prepend that opening tag. If you don't want that (and want php codeblocks without an open tag to fail), you can disable this:

parameters:
    docCodeAnalyzer:
        prependOpenTagWhenMissing: false

Set strict_types to true when adding missing opening tag

When the opening tag is not present, Besides automatically adding the tag, it will also enable strict_types. If you just want the automatic open tag without strict types, you can disable this:

parameters:
    docCodeAnalyzer:
        setStrictTypesWhenOpenTagMissing: false
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky