diff --git a/docs/running_psalm/installation.md b/docs/running_psalm/installation.md index 071ba3f5dc0..2d4f32d6b4a 100644 --- a/docs/running_psalm/installation.md +++ b/docs/running_psalm/installation.md @@ -28,7 +28,7 @@ While Psalm can figure out the types used by various libraries based on 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](https://packagist.org/?type=psalm-plugin). +Check out the [list of existing plugins on Packagist](https://packagist.org/?type=psalm-plugin). Install them with `composer require --dev && vendor/bin/psalm-plugin enable ` Read more about plugins in [Using Plugins chapter](plugins/using_plugins.md). @@ -51,3 +51,54 @@ Alternatively, you can use Composer to install the Phar: ```bash composer require --dev psalm/phar ``` + +## Using a Snapshot Build + +To obtain the latest development version of Psalm, a snapshot build can be +downloaded from GitHub at https://github.com/vimeo/psalm/archive/refs/heads/5.x.zip + +Snapshot builds typically include only the source code and exclude the `.git` +directory. As a result, Psalm cannot automatically determine its version or +revision when executing `composer install`, since this information is usually +derived from the `git` repository metadata that Composer relies on. + +To successfully install Psalm from a snapshot build, it is necessary to +manually specify the version using the `COMPOSER_ROOT_VERSION` environment +variable. This allows Composer to proceed with the installation of Psalm. + +The command to do so is as follows: + +```bash +COMPOSER_ROOT_VERSION=5-dev composer install +``` + +## Installing Psalm on Linux + +Psalm is available across various Linux distributions, each typically equipped +with its own package management system. To install Psalm, refer to the +documentation specific to your distribution's package manager. + +### Installation on Nix + +For users of Nix, Psalm is readily [available](https://search.nixos.org/packages?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=psalm) +and can be installed or run using several methods. + +To run Psalm directly, use the following command: + +```bash +nix run github:NixOS/nixpkgs-unstable#php.packages.psalm +``` + +For an ephemeral shell environment with Psalm, either of the following commands +can be used: + +```bash +nix-shell -p php.packages.psalm +``` + +```bash +nix shell github:NixOS/nixpkgs-unstable#php.packages.psalm +``` + +Psalm builds on Nix are reproducible, ensuring that executing the same command +on any system yields an identical build of Psalm.