larastan

Configure PHPStan and Larastan to analyze Laravel projects for code issues.

1|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/ohnotnow/agentic-stuff --skill larastan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: larastan
Source: https://github.com/ohnotnow/agentic-stuff/tree/main/skills/larastan
Command: npx skills add https://github.com/ohnotnow/agentic-stuff --skill larastan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PHPStan/Larastan helps Laravel projects catch real code-quality issues by filtering out framework noise and magic patterns that confuse static analysis.

Core Features & Use Cases

  • Noise filtering to surface genuine defects by accounting for Laravel's dynamic properties, casts, and relations.
  • Setup guidance to install Larastan, generate or update phpstan.neon, and adjust ignore rules for common patterns.
  • Incremental quality improvements by stepping through PHPStan levels from 1 to 5 as projects mature.

Quick Start

Run PHPStan analysis in the Laravel project root to begin surfacing real issues and iteratively fix them.

Frequently Asked Questions about larastan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run static analysis on a Laravel project without false positives from framework magic?

Larastan extends PHPStan to filter Laravel's dynamic properties and magic patterns, surfacing genuine code quality issues. By configuring a phpstan.neon file, it accounts for framework noise like casts and relations to identify real defects.

What is the best way to progressively increase PHPStan levels in a mature Laravel codebase?

You can incrementally raise PHPStan analysis levels from 1 to 5 as your Laravel project matures. This approach allows you to iteratively fix detected issues and progressively improve code quality without overwhelming the development workflow.

How do I configure phpstan.neon to ignore specific Larastan errors in my code?

You can configure phpstan.neon to adjust ignore rules for common Laravel patterns. Additionally, Larastan supports inline ignores and PHPDoc annotations to suppress false positives directly in your code where framework-specific magic is intentionally used.

Does PHPStan work with Laravel's dynamic properties and model relations?

Yes, PHPStan works with Laravel when extended with Larastan. It accounts for dynamic properties, casts, and relations, filtering out framework noise to ensure the static analysis targets real defects rather than reporting standard Laravel magic as errors.

Why does standard PHPStan report errors on my Laravel model casts and relations?

Standard PHPStan reports errors on Laravel casts and relations because it does not understand the framework's dynamic magic without extensions. Installing Larastan configures the analysis to recognize these patterns and filter out the framework noise.