PHPackages                             canvural/phpstan-blade-rule - 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. [Templating &amp; Views](/categories/templating)
4. /
5. canvural/phpstan-blade-rule

ActivePhpstan-extension[Templating &amp; Views](/categories/templating)

canvural/phpstan-blade-rule
===========================

PHPStan rule for static analysis of Blade templates

v0.4(4y ago)5794.8k↑74.2%5[3 issues](https://github.com/canvural/phpstan-blade-rule/issues)[2 PRs](https://github.com/canvural/phpstan-blade-rule/pulls)2MITPHPPHP ^8.0

Since Feb 3Pushed 3y ago2 watchersCompare

[ Source](https://github.com/canvural/phpstan-blade-rule)[ Packagist](https://packagist.org/packages/canvural/phpstan-blade-rule)[ Fund](https://www.paypal.me/canvural)[ GitHub Sponsors](https://github.com/canvural)[ RSS](/packages/canvural-phpstan-blade-rule/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (4)Dependencies (10)Versions (5)Used By (2)

phpstan-blade-rule
==================

[](#phpstan-blade-rule)

 [![Build Status](https://github.com/canvural/phpstan-blade-rule/workflows/Tests/badge.svg)](https://github.com/canvural/phpstan-blade-rule/actions) ![PHPStan level max](https://camo.githubusercontent.com/d300bb2a4c15228ad2fa238fe49f1aa67ea3fb95332a246ab4303af0d3a0178e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c2532304d61782d627269676874677265656e2e7376673f7374796c653d666c6174266c6f676f3d706870) [![Total Downloads](https://camo.githubusercontent.com/7f10086f9c1b526d18d7d40051e9918b60513c4becbeae4b16ab20b89581d657/68747470733a2f2f706f7365722e707567782e6f72672f63616e767572616c2f7068707374616e2d626c6164652d72756c652f642f746f74616c2e737667)](https://packagist.org/packages/canvural/phpstan-blade-rule/stats) [![Latest Version](https://camo.githubusercontent.com/dbcd16887433bb53cb166146a7309344dada0faf5bcd6335326ae8b6b449c83e/68747470733a2f2f706f7365722e707567782e6f72672f63616e767572616c2f7068707374616e2d626c6164652d72756c652f762f737461626c652e737667)](https://packagist.org/packages/canvural/phpstan-blade-rule) [![License](https://camo.githubusercontent.com/3601f2c49fb4c8998da3d7f823078196ca2dff69e34c41424d3b7515fbf89d06/68747470733a2f2f706f7365722e707567782e6f72672f63616e767572616c2f7068707374616e2d626c6164652d72756c652f6c6963656e73652e737667)](https://github.com/canvural/phpstan-blade-rule/blob/main/LICENSE.md)

 PHPStan rule for static analysis of Blade templates.

---

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

[](#installation)

To use this extension, require it in [Composer](https://getcomposer.org/):

```
composer require --dev canvural/phpstan-blade-rule
```

If you also have [phpstan/extension-installer](https://github.com/phpstan/extension-installer) installed, then you're all set!

 Manual installationIf you don't want to use `phpstan/extension-installer`, include extension.neon in your project's PHPStan config:

```
includes:
    - vendor/canvural/phpstan-blade-rule/config/extension.neon
    - vendor/symplify/template-phpstan-compiler/config/services.neon
    - vendor/symplify/astral/config/services.neon
```

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

[](#configuration)

You need to configure paths of views for the rule to scan using `templatePaths` config parameter key. Each path should be a relative path to your `phpstan.neon` config file.

For example for default Laravel installation, you can configure the paths like so:

```
parameters:
    templatePaths:
        - resources/views
```

⚠️ The paths you add to `templatePaths` should be **relative** to the root of your app (for example where your `vendor` folder is or where your `phpstan.neon` is), and should **not** contain `..` or `.`

Features
--------

[](#features)

### Custom error formatter

[](#custom-error-formatter)

We provide custom PHPStan error formatter to better display the template errors. The custom error formatter extends the PHPStan's table error formatter and just adds additional information about template errors to the message.

An example: [![](./assets/example.png "Custom error formatter output example")](./assets/example.png)

To use this custom error formatter you need to run PHPStan with `--error-format blade` option. For example:

```
vendor/bin/phpstan analyse src -l8 --error-format blade
```

### Known issues / TODOs

[](#known-issues--todos)

- Custom directives are not supported. Can be supported by custom bootstrap file maybe.
- Blade components are not analyzed. Support for it will come soon.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

People:

- [Can Vural](https://github.com/canvural)
- [All Contributors](https://github.com/canvural/phpstan-blade-rule/contributors)

Resources:

- [symplify/template-phpstan-compiler](https://github.com/symplify/template-phpstan-compiler)
- [symplify/twig-phpstan-compiler](https://github.com/symplify/twig-phpstan-compiler)
- [symplify/latte-phpstan-compiler](https://github.com/symplify/latte-phpstan-compiler)
- [symplify/phpstan-latte-rules](https://github.com/symplify/phpstan-latte-rules)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.9% 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 ~5 days

Total

4

Last Release

1593d ago

### Community

Maintainers

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

---

Top Contributors

[![canvural](https://avatars.githubusercontent.com/u/1574232?v=4)](https://github.com/canvural "canvural (47 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (1 commits)")[![ThibaudDauce](https://avatars.githubusercontent.com/u/1770543?v=4)](https://github.com/ThibaudDauce "ThibaudDauce (1 commits)")

---

Tags

bladeblade-templatelaravelphpstan

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/canvural-phpstan-blade-rule/health.svg)

```
[![Health](https://phpackages.com/badges/canvural-phpstan-blade-rule/health.svg)](https://phpackages.com/packages/canvural-phpstan-blade-rule)
```

###  Alternatives

[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[blade-ui-kit/blade-icons

A package to easily make use of icons in your Laravel Blade views.

2.5k42.5M404](/packages/blade-ui-kit-blade-icons)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.0k14](/packages/tallstackui-tallstackui)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)

PHPackages © 2026

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