PHPackages                             php-standard-library/phpstan-extension - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. php-standard-library/phpstan-extension

ActivePhpstan-extension[PSR &amp; Standards](/categories/psr-standards)

php-standard-library/phpstan-extension
======================================

PHPStan PSL extension

2.1.0(2mo ago)201.2M↓17.4%6[13 issues](https://github.com/php-standard-library/phpstan-extension/issues)[5 PRs](https://github.com/php-standard-library/phpstan-extension/pulls)12MITPHPPHP ^7.4 || ^8.0CI passing

Since Jun 10Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/php-standard-library/phpstan-extension)[ Packagist](https://packagist.org/packages/php-standard-library/phpstan-extension)[ RSS](/packages/php-standard-library-phpstan-extension/feed)WikiDiscussions 2.0.x Synced 1mo ago

READMEChangelog (8)Dependencies (16)Versions (16)Used By (12)

PHPStan PSL extension
=====================

[](#phpstan-psl-extension)

[![Build](https://github.com/php-standard-library/phpstan-extension/workflows/Build/badge.svg)](https://github.com/php-standard-library/phpstan-extension/actions)[![Latest Stable Version](https://camo.githubusercontent.com/1914e48d30af24c8caf15d50efa64d0920328d0b0e110d737612493e6f5645eb/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374616e646172642d6c6962726172792f7068707374616e2d657874656e73696f6e2f762f737461626c65)](https://packagist.org/packages/php-standard-library/phpstan-extension)[![License](https://camo.githubusercontent.com/cabbb94a143fae71fb25086939804a19c44fb143424b0579af5ee21ec424c84f/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374616e646172642d6c6962726172792f7068707374616e2d657874656e73696f6e2f6c6963656e7365)](https://packagist.org/packages/php-standard-library/phpstan-extension)

- [PHPStan](https://phpstan.org/)
- [PSL](https://github.com/php-standard-library/php-standard-library)

Description
-----------

[](#description)

The main goal of this extension is to help PHPStan to detect the types after using `Psl\Type\shape`.

Given the following example:

```
use Psl\Type;

$specification = Type\shape([
    'name' => Type\string(),
    'age' => Type\int(),
    'location' => Type\optional(Type\shape([
        'city' => Type\string(),
        'state' => Type\string(),
        'country' => Type\string(),
    ]))
]);

$input = $specification->coerce($_GET['user']);
```

PHPStan assumes that `$input` is of type `array`.

If we enable the extension, you will get a more specific and correct type of `array{name: string, age: int, location?: array{city: string, state: string, country: string}}`.

Besides coerce, this extension also supports `matches()` and `assert()` methods.

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

[](#installation)

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

```
composer require --dev php-standard-library/phpstan-extension

```

If you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) 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/php-standard-library/phpstan-extension/extension.neon

```

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance76

Regular maintenance activity

Popularity50

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% 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 ~137 days

Recently: every ~27 days

Total

11

Last Release

62d ago

Major Versions

1.1.x-dev → 2.0.02024-11-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/258cf2d2422f7e9ac5f7e1bb7a331f3fb717a11e51de7a3de2d6025507bd63cf?d=identicon)[ondrejmirtes](/maintainers/ondrejmirtes)

![](https://www.gravatar.com/avatar/8489d7c85bfa7c637b8e13484f3f659652aea0568b6e7f9e66edeb0649b5a2f1?d=identicon)[azjezz](/maintainers/azjezz)

---

Top Contributors

[![ondrejmirtes](https://avatars.githubusercontent.com/u/104888?v=4)](https://github.com/ondrejmirtes "ondrejmirtes (30 commits)")[![veewee](https://avatars.githubusercontent.com/u/1618158?v=4)](https://github.com/veewee "veewee (4 commits)")[![BackEndTea](https://avatars.githubusercontent.com/u/14289961?v=4)](https://github.com/BackEndTea "BackEndTea (3 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (1 commits)")[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (1 commits)")[![YspMark](https://avatars.githubusercontent.com/u/55830693?v=4)](https://github.com/YspMark "YspMark (1 commits)")[![devnix](https://avatars.githubusercontent.com/u/1777519?v=4)](https://github.com/devnix "devnix (1 commits)")[![shirshir](https://avatars.githubusercontent.com/u/660457?v=4)](https://github.com/shirshir "shirshir (1 commits)")

###  Code Quality

TestsPHPUnit

Type Coverage Yes

### Embed Badge

![Health badge](/badges/php-standard-library-phpstan-extension/health.svg)

```
[![Health](https://phpackages.com/badges/php-standard-library-phpstan-extension/health.svg)](https://phpackages.com/packages/php-standard-library-phpstan-extension)
```

###  Alternatives

[league/container

A fast and intuitive dependency injection container.

86787.8M343](/packages/league-container)[stella-maris/clock

A pre-release of the proposed PSR-20 Clock-Interface

7947.5M2](/packages/stella-maris-clock)[bnf/phpstan-psr-container

PHPStan dynamic return type extension for PSR-11 ContainerInterface

133.5M53](/packages/bnf-phpstan-psr-container)

PHPackages © 2026

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