Skip to content
settings

GitHub Action

Setup PHPStan Action

v1.0.2 Latest version

Setup PHPStan Action

settings

Setup PHPStan Action

GitHub action for setting up PHPStan in an actions environment

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Setup PHPStan Action

uses: NxtLvLSoftware/[email protected]

Learn more about this action in NxtLvLSoftware/setup-phpstan-action

Choose a version

Action nxtlvlsoftware/setup-phpstan-action

GitHub action for installing PHPStan in actions workflows.

  • Allows passing version string and installing from github releases into path/env.
  • Allows passing existing executable path and installing into path/env.
  • Supports caching for version string and existing binary installations.
Action Input Required Default Description
install-path true The path to install PHPStan binary to.
version false latest The target PHPStan version to install. Exact versions only (8.0.11, 7.4.24, etc.)
path false false Path to an existing PHPStan installation.

Either version or path must be specified.

How to use

Attempt to download any PHPStan release by providing the version:

name: My PHPStan Workflow
on: [push]
jobs:
  setup-phpstan:
    name: Setup PHPStan
    runs-on: ubuntu-latest
    steps:
      - uses: nxtlvlsoftware/setup-phpstan-action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          version: '1.8.2'
          install-path: './bin'

Forwarding the $GIHUB_TOKEN environment variable is required to properly configure PHPStan as we interact with the GitHub API to fetch version information.

Or provide the path to an existing PHPStan installation/binary:

name: My PHPStan Workflow
on: [push]
jobs:
  setup-phpstan:
    name: Setup PHPStan
    runs-on: ubuntu-latest
    steps:
      - uses: nxtlvlsoftware/setup-phpstan-action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          path: 'path/to/your/phpstan.phar'
          install-path: './bin'

License

nxtlvlsoftware/setup-phpstan-action is open-sourced software licensed under the MIT license.