psalm/plugin-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

psalm/plugin-laravel

最新稳定版本:v3.0.4

Composer 安装命令:

composer require --dev psalm/plugin-laravel

包简介

Psalm plugin for Laravel

README 文档

README

The package is seeking maintainers

⚠️ This is a perfect opportunity to learn Laravel very deep and collaborate with other high-skilled developers. At this moment, the package is maintained almost solely by @alies-dev, and he is looking for developers to build a team who can constantly improve this package and the whole Psalm ecosystem.

Some ideas to implement:

  • Fully support custom Model Query Builders (medium)
  • Add an option to rely on Model @property declarations only
  • Get rid of barryvdh/laravel-ide-helper dependency and be more accurate with attribute types
  • Support .sql files for migrations (to find information about attributes and their types)

Packagist version Packagist downloads Type coverage Tests Tests

Overview

This Psalm plugin 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

Maintained versions:

Laravel Psalm Plugin PHP Laravel Psalm
3.x ^8.2 11, 12 6, 7
2.12+ ^8.0 9, 10, 11 5, 6

(Older versions of Laravel, PHP, and Psalm were supported by version 1.x of the plugin, but they are no longer maintained)

See releases for more details about supported PHP, Laravel and Psalm versions.

Quickstart

Step 1: Install

composer require --dev psalm/plugin-laravel

Step 2: Configure

If you didn't use Psalm on the project before, you need to create a Psalm config:

./vendor/bin/psalm --init

Step 3: enable the plugin:

./vendor/bin/psalm-plugin enable psalm/plugin-laravel

Step 4: Run ????

Run your usual Psalm command:

./vendor/bin/psalm

You can customize Psalm configuration using XML config and/or cli parameters.

Recommendation: use baseline file and increase errorLevel at least to 4: this way you can catch more issues. Step by step set errorLevel to 1 and use Psalm and this plugin at full power ????.

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.

Psalm-Laravel-Plugin or Larastan?

Both! It's fine to use both tools at the same project: they use different approaches to analyze code, and thus you can find more bugs! Psalm and PHPStan use almost same the syntax annotations, so you should not have any conflicts.

统计信息

  • 总下载量: 4.66M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 324
  • 点击次数: 1
  • 依赖项目数: 328
  • 推荐数: 1

GitHub 信息

  • Stars: 324
  • Watchers: 9
  • Forks: 76
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04