New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

nunomaduro/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel
48,814,540 6,560

Larablocks Analysis

Compatibility

Trusted maintainer

nunomaduro/larastan works with Laravel 11, 12 and 13 (latest release v3.15.0, Nov 11, 2026).

Laravel 5 to 10 in earlier releases.

  • Trusted maintainer: nunomaduro publishes 16 packages on Larablocks, with 52,810,380 downloads a month between them.

Recommendation checks

Replacement recommended

Replacement recommended: use larastan/larastan instead. Named by its author on Packagist.

  • Marked abandoned on Packagist
  • Works with Laravel 13, the current version
  • Released in the last 12 months (Nov 11, 2026)
  • 435,350 downloads a month (at least 10,000)
  • 6,560 GitHub stars (at least 100)

State

Abandoned
  • Packagist marks this package abandoned.
  • Last stable release: Nov 11, 2026.
  • 19 releases in the last 12 months.
  • First released: Jul 17, 2018.
  • Monthly downloads: 435,350.
  • 84 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.

Install
composer require nunomaduro/larastan
Latest Version:v3.15.0
PHP:^8.2
Laravel:11 · 12 · 13
Older releases:5 – 10
License:MIT
Last Updated:Nov 22, 2026
Links: GitHub  ·  Packagist
Maintainer: nunomaduro

Larastan Logo

Larastan Example

Build Status Total Downloads Latest Version License


⚗️ About Larastan

Larastan was created by Can Vural and Nuno Maduro, got artwork designed by @Caneco, is maintained by Can Vural, Nuno Maduro and Viktor Szépe, and is a PHPStan extension for Laravel. Larastan focuses on finding errors in your code. It catches whole classes of bugs even before you write tests for the code.

  • Adds static typing to Laravel to improve developer productivity and code quality
  • Supports most of Laravel's beautiful magic
  • Discovers bugs in your code

While by definition, "static analysis" doesn't load any of your application's code. Larastan boots your application's container, so it can resolve types that are only possible to compute at runtime. That's why we use the term "code analysis" instead of "static analysis".

Supported Laravel versions

Laravel Version Larastan Version
< 9 1.x
> 9.0 && >= 11.16 2.x
11.16+ 3.0+

Sponsors

Blackfire.io

✨ Getting Started In 3 Steps

Requires:

1: First, you may use Composer to install Larastan as a development dependency into your Laravel project:

composer require --dev "larastan/larastan:^3.0"

Using Larastan for analysing Laravel packages? You may need to install orchestra/testbench.

2: Then, create a phpstan.neon or phpstan.neon.dist file in the root of your application. It might look like this:

includes:
    - vendor/larastan/larastan/extension.neon
    - vendor/nesbot/carbon/extension.neon

parameters:

    paths:
        - app/

    # Level 10 is the highest level
    level: 5

#    ignoreErrors:
#        - '#PHPDoc tag @var#'
#
#    excludePaths:
#        - ./*/*/FileToBeExcluded.php

For all available options, please take a look at the PHPStan documentation: https://phpstan.org/config-reference

3: Finally, you may start analyzing your code using the phpstan console command:

./vendor/bin/phpstan analyse

If you are getting the error Allowed memory size exhausted, then you can use the --memory-limit option fix the problem:

./vendor/bin/phpstan analyse --memory-limit=2G

Ignoring errors

Ignoring a specific error can be done either with a php comment or in the configuration file:

// @phpstan-ignore-next-line
$test->badMethod();

$test->badMethod(); // @phpstan-ignore-line

When ignoring errors in PHPStan's configuration file, they are ignored by writing a regex based on error messages:

parameters:
    ignoreErrors:
        - '#Call to an undefined method .*badMethod\(\)#'

Baseline file

In older codebases it might be hard to spend the time fixing all the code to pass a high PHPStan Level.

To get around this a baseline file can be generated. The baseline file will create a configuration file with all of the current errors, so new code can be written following a higher standard than the old code. (PHPStan Docs)

./vendor/bin/phpstan analyse --generate-baseline

Rules

A list of configurable rules specific to Laravel can be found here.

Features

A list of Larastan features can be found here.

Custom PHPDoc types

A list of PHPDoc types specific to Larastan can be found here.

Custom PHPStan config parameters

A list of custom config parameters that you can use in your PHPStan config file can be found here.

Errors To Ignore

Some parts of Laravel are currently too magical for Larastan/PHPStan to understand. We listed common errors to ignore, add them as needed

👊🏻 Contributing

Thank you for considering contributing to Larastan. All the contribution guidelines are mentioned here.

📖 License

Larastan is an open-sourced software licensed under the MIT license.

Alternatives to nunomaduro/larastan

shipmonk/dead-code-detector

Dead code detector to find unused PHP code via PHPStan extension. Can automatica...

8,468,318 539
calebdw/phpstan-laravel

A PHPStan extension for analysis of Laravel applications and packages.

38,319 38
hosmelq/php-coding-standard

Opinionated ECS, Rector, and PHPStan presets for PHP and Laravel packages and ap...

2,606 1
edalzell/dead-code-detector-laravel

PHPStan extensions teaching shipmonk/dead-code-detector about Eloquent trait hoo...

2,313 0
mfn/phpstan-lost-in-translation

Helps find missing translation strings in Laravel applications

9,642 1

Version History

Version Released PHP Laravel License
v3.15.0 ^8.2 ^11.44.2 || ^12.4.1 || ^13 MIT
v3.14.0 ^8.2 ^11.44.2 || ^12.4.1 || ^13 MIT
v3.13.2 ^8.2 ^11.44.2 || ^12.4.1 || ^13 MIT
v3.13.1 ^8.2 ^11.44.2 || ^12.4.1 || ^13 MIT
v3.13.0 ^8.2 ^11.44.2 || ^12.4.1 || ^13 MIT