1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 02:47:02 +01:00
psalm/docs/running_psalm/installation.md

1.4 KiB
Raw Blame History

Installation

The latest version of Psalm requires PHP >= 7.1 and Composer.

composer require --dev vimeo/psalm

Generate a config file:

./vendor/bin/psalm --init

Psalm will scan your project and figure out an appropriate error level for your codebase.

Then run Psalm:

./vendor/bin/psalm

Psalm will probably find a number of issues - find out how to deal with them in Dealing with code issues.

Installing plugins

While Psalm can figure out the types used by various libraries based on the their source code and docblocks, it works even better with custom-tailored types provided by Psalm plugins.

Check out the list of existing plugins on Packagist. Install them with composer require --dev <plugin/package> && vendor/bin/psalm-plugin enable <plugin/package>

Read more about plugins in Using Plugins chapter.

Using the Phar

Sometimes your project can conflict with one or more of Psalms dependencies. In that case you may find the Phar (a self-contained PHP executable) useful.

The Phar can be downloaded from Github:

wget https://github.com/vimeo/psalm/releases/latest/download/psalm.phar
chmod +x psalm.phar
./psalm.phar --version

Alternatively, you can use Composer to install the Phar:

composer require --dev psalm/phar