Announcing Psalm support for Laravel

March 5, 2019 by Matt Brown - original article

Today I’m releasing a Psalm plugin for Laravel!


Two months ago I announced the latest version of Psalm, and discussed how its new plugin framework would make authoring integrations for third-party packages much easier. A bunch of great plugins have sprung up since, but none for Laravel.

Authoring a such a plugin from scratch requires an in-depth knowledge of that framework. Nobody came forward to volunteer, and my own experience with Laravel is essentially zero.

Luckily there’s a popular tool that’s done most of the work already: the Laravel IDE Helper. It generates static files that help PHPStorm understand Laravel’s functions and methods.

There are two types of files the IDE Helper generates:

Psalm already understood regular stubs, and adding support for the IDE Helper’s generated .phpstorm.meta.php was relatively simple. The plugin generates those files in a separate directory, and tells Psalm to use them in its analysis.

The advantage of this approach is threefold:


If you haven’t already, install Psalm. Then run

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

Head to the plugin’s Github repo for all the usual open source stuff.

Thanks to Barry vd. Heuvel for creating and maintaining the Laravel IDE Plugin, and to a number of contributors for improving Psalm’s plugin architecture so this was a reasonably simple integration.