PHPackages                             magdv/phpstan-yii2 - 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. magdv/phpstan-yii2

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

magdv/phpstan-yii2
==================

Yii2 extension for PHPStan

011PHP

Since Jan 15Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 extension for PHPStan
==========================

[](#yii2-extension-for-phpstan)

[![Minimum PHP Version](https://camo.githubusercontent.com/4c62148864d567c4ee794ffab09c1dd4a3f45e41064bbb016440beddaae71a4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e322d3838393242462e737667)](https://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/ccd2a8759b33e60662a008adbe0f5e1113200a91cd75a9b0836ba20cca5b46d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70726f6765742d68712f7068707374616e2d796969322e737667)](https://packagist.org/packages/proget-hq/phpstan-yii2)[![Build Status](https://github.com/proget-hq/phpstan-yii2/workflows/build/badge.svg)](https://github.com/proget-hq/phpstan-yii2/actions?query=workflow%3Abuild)[![Total Downloads](https://camo.githubusercontent.com/641b0a0c68a0b9a6556204a6fe44752a1bb4976e6b4cc1d8d84371788a507a68/68747470733a2f2f706f7365722e707567782e6f72672f70726f6765742d68712f7068707374616e2d796969322f646f776e6c6f6164732e737667)](https://packagist.org/packages/proget-hq/phpstan-yii2)[![License](https://camo.githubusercontent.com/3cbe6209a43b564657f8892bbfa3dd30ebf0b68c0f80230915c6d0bb6b3cc4b6/68747470733a2f2f706f7365722e707567782e6f72672f70726f6765742d68712f7068707374616e2d796969322f6c6963656e73652e737667)](https://packagist.org/packages/proget-hq/phpstan-yii2)

What does it do?
----------------

[](#what-does-it-do)

- Provides correct return type for `Yii::$container->get('service_id')` method,
- Provides correct methods and properties for `Yii::$app->request`
- Ignore common problems with response objects (to be removed).

Compatibility
-------------

[](#compatibility)

PHPStan versionYii2 extension version1.x0.8.x0.120.7.x0.110.5.x - 0.6.x0.10.30.4.x0.100.3.00.9.20.2.0Installation
------------

[](#installation)

```
composer require --dev proget-hq/phpstan-yii2
```

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

[](#configuration)

Put this into your `phpstan.neon` config:

```
includes:
	- vendor/proget-hq/phpstan-yii2/extension.neon
parameters:
    yii2:
        config_path: %rootDir%/../../../config/test.php
```

Limitations
-----------

[](#limitations)

Container closures must have return types.

You have to provide a path to `config/test.php` or other yii2 config file.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![marmichalski](https://avatars.githubusercontent.com/u/57528542?v=4)](https://github.com/marmichalski "marmichalski (23 commits)")[![akondas](https://avatars.githubusercontent.com/u/8239917?v=4)](https://github.com/akondas "akondas (20 commits)")[![EtienneBruines](https://avatars.githubusercontent.com/u/3962174?v=4)](https://github.com/EtienneBruines "EtienneBruines (4 commits)")[![danieljonderko](https://avatars.githubusercontent.com/u/3042592?v=4)](https://github.com/danieljonderko "danieljonderko (3 commits)")[![Khartir](https://avatars.githubusercontent.com/u/5592420?v=4)](https://github.com/Khartir "Khartir (2 commits)")[![dawidrylko](https://avatars.githubusercontent.com/u/11761319?v=4)](https://github.com/dawidrylko "dawidrylko (1 commits)")[![particleflux](https://avatars.githubusercontent.com/u/3686454?v=4)](https://github.com/particleflux "particleflux (1 commits)")[![przepompownia](https://avatars.githubusercontent.com/u/11404453?v=4)](https://github.com/przepompownia "przepompownia (1 commits)")

### Embed Badge

![Health badge](/badges/magdv-phpstan-yii2/health.svg)

```
[![Health](https://phpackages.com/badges/magdv-phpstan-yii2/health.svg)](https://phpackages.com/packages/magdv-phpstan-yii2)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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