PHPackages                             yii2-extensions/phpstan - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. yii2-extensions/phpstan

ActiveLibrary[Testing &amp; Quality](/categories/testing)

yii2-extensions/phpstan
=======================

PHPStan extension for Yii2

0.4.0(3mo ago)12123.8k↑113.8%215BSD-3-ClausePHPPHP &gt;=8.1CI passing

Since Feb 27Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/yii2-extensions/phpstan)[ Packagist](https://packagist.org/packages/yii2-extensions/phpstan)[ RSS](/packages/yii2-extensions-phpstan/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (8)Versions (10)Used By (15)

    ![Yii Framework](https://camo.githubusercontent.com/6f0a7c6c5e9ed8d389db5c82af26a2f70418756b736357378178997e52296488/68747470733a2f2f7777772e7969696672616d65776f726b2e636f6d2f696d6167652f64657369676e2f6c6f676f2f796969335f66756c6c5f666f725f6461726b2e737667)

PHPStan
=======

[](#phpstan)

 [ ![PHPUnit](https://camo.githubusercontent.com/1b82f63ded3cd630b348b92aaf0dc4bbee0105949e00b2be0b8eb9a14de15446/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969322d657874656e73696f6e732f7068707374616e2f6275696c642e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d504850556e6974) ](https://github.com/yii2-extensions/phpstan/actions/workflows/build.yml) [ ![PHPStan](https://camo.githubusercontent.com/9af70dd2dca4b4fefebea60ce5193324ee3d71fbdca58059bf5cc2087e0f5029/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969322d657874656e73696f6e732f7068707374616e2f7374617469632e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d5048505374616e) ](https://github.com/yii2-extensions/phpstan/actions/workflows/static.yml)

 **Enhanced static analysis for Yii2 applications with PHPStan**
 *Precise type inference, dynamic method resolution, and comprehensive property reflection*

Features
--------

[](#features)

  ![Feature Overview](./docs/svgs/features-mobile.svg)### Installation

[](#installation)

```
composer require --dev yii2-extensions/phpstan:^0.3
```

### Quick start

[](#quick-start)

Create a `phpstan.neon` file in your project root.

```
includes:
    - vendor/yii2-extensions/phpstan/extension.neon

parameters:
    level: 5

    paths:
        - src
        - controllers
        - models

    tmpDir: %currentWorkingDirectory%/runtime

    yii2:
        config_path: config/phpstan-config.php
        component_generics:
            user: identityClass      # Built-in (already configured)
            repository: modelClass   # Custom generic component
```

Create a PHPStan-specific config file (`config/phpstan-config.php`).

```
