2020-01-08 06:41:32 +01:00
# Psalm plugin for Laravel
2019-02-19 01:02:49 +01:00
2020-04-18 22:44:42 +02:00
[![Packagist ](https://img.shields.io/packagist/v/psalm/plugin-laravel.svg )](https://packagist.org/packages/psalm/plugin-laravel)
[![Packagist ](https://img.shields.io/packagist/dt/psalm/plugin-laravel.svg )](https://packagist.org/packages/psalm/plugin-laravel)
2020-01-08 06:17:32 +01:00
![Type coverage ](https://shepherd.dev/github/psalm/laravel-psalm-plugin/coverage.svg )
2020-04-18 22:44:42 +02:00
![dev-master Tests ](https://img.shields.io/github/workflow/status/psalm/psalm-plugin-laravel/Run%20Tests?label=dev-master%20tests )
2020-01-08 06:17:32 +01:00
2020-04-18 22:44:42 +02:00
## 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!
2020-04-29 21:10:51 +02:00
![Screenshot ](/assets/screenshot.png )
2022-05-02 19:39:15 +02:00
## Versions
Laravel 6 | Laravel 7 | Laravel 8 | Laravel 9
--------- | --------- | --------- | -----------
v1.* | v1.* | v1.* | v2.*
2020-04-18 22:44:42 +02:00
## Quickstart
Please refer to the [full Psalm documentation ](https://psalm.dev/quickstart ) for a more detailed guide on introducing Psalm
into your project.
2019-03-11 05:53:27 +01:00
2020-04-18 22:44:42 +02:00
First, start by installing Psalm if you have not done so already:
```bash
composer require --dev vimeo/psalm
./vendor/bin/psalm --init
2019-02-19 01:02:49 +01:00
```
2020-04-18 22:44:42 +02:00
Next, install this package and enable the plugin
```bash
2019-02-19 01:02:49 +01:00
composer require --dev psalm/plugin-laravel
2020-04-18 22:44:42 +02:00
./vendor/bin/psalm-plugin enable psalm/plugin-laravel
```
Finally, run Psalm to analyze your codebase
```bash
./vendor/bin/psalm
2019-02-19 01:02:49 +01:00
```
## How it works
2020-08-25 07:30:00 +02:00
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.
2020-03-10 13:48:51 +01:00
It also parses any database migrations it can find to try to understand property types in your database models.
2019-02-19 01:02:49 +01:00