Download link to the latest PHPStan PHAR file

20 Jan 2019

With PHPStan 0.12, the phpstan/phpstan-shim composer package will not be updated anymore. Read more

But you still can download the latest phpstan.phar file directly from Github.

The url is:


Add the following scripts to your composer.json file:

"scripts": {
    "install-phpstan": "php -r \"@mkdir('build'); if(!file_exists('build/phpstan.phar')) copy('', 'build/phpstan.phar');\"",
    "phpstan": "php build/phpstan.phar analyse src --level=max --no-progress",


composer install-phpstan


composer phpstan

Apache Ant

Add this to your build.xml file:

<target name="phpstan" description="PHP Static Analysis Tool">
    <mkdir dir="${basedir}/build"/>
    <get src=""
         dest="${basedir}/build/phpstan.phar" skipexisting="true"/>
    <exec executable="php" searchpath="true" resolveexecutable="true" failonerror="true">
        <arg value="${basedir}/build/phpstan.phar"/>
        <arg value="analyse"/>
        <arg value="-l"/>
        <arg value="max"/>
        <arg value="src"/>
        <arg value="--no-interaction"/>
        <arg value="--no-progress"/>

Then run ant phpstan.