Skip to content

Commit

Permalink
doc: add installation method documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol authored and weirdan committed Feb 26, 2024
1 parent b940c7e commit b2d5826
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion docs/running_psalm/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <plugin/package> && vendor/bin/psalm-plugin enable <plugin/package>`

Read more about plugins in [Using Plugins chapter](plugins/using_plugins.md).
Expand All @@ -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.

0 comments on commit b2d5826

Please sign in to comment.