psalm/plugin-laravel

A Laravel plugin for Psalm

Installs: 1 906 258

Dependents: 224

Suggesters: 1

Security: 0

Stars: 243

Watchers: 9

Forks: 64

Open Issues: 19

Type:psalm-plugin


README

Packagist version Packagist downloads Type coverage Tests Tests

Overview

This package brings static analysis and type support to projects using Laravel. Our goal is to find as many type-related bugs as possible, therefore increasing developer productivity and application health. Find bugs without the overhead of writing tests!

Screenshot

Versions & Dependencies

Laravel Psalm Plugin PHP Laravel Psalm
3.x ^8.0 9, 10 5
2.x ^8.0 8, 9 4, 5
1.x ^7.1 5, 6, 7, 8 3, 4

Quickstart

Please refer to the full Psalm documentation for a more detailed guide on introducing Psalm into your project.

First, start by installing Psalm if you have not done so already:

composer require --dev vimeo/psalm
./vendor/bin/psalm --init

Next, install this package and enable the plugin

composer require --dev psalm/plugin-laravel
./vendor/bin/psalm-plugin enable psalm/plugin-laravel

Finally, run Psalm to analyze your codebase

./vendor/bin/psalm

How it works

Under the hood it just runs https://github.com/barryvdh/laravel-ide-helper and feeds the resultant stubs into Psalm, which can read PhpStorm meta stubs.

It also parses any database migrations it can find to try to understand property types in your database models.