Download the PHP package slam/phpstan-extensions without Composer

On this page you can find all versions of the php package slam/phpstan-extensions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpstan-extensions

Slam PHPStan extensions

Latest Stable Version Downloads Integrate Code Coverage

Extensions for PHPStan

Installation

To use this extension, require it in Composer:

Usage

When you are using phpstan/extension-installer, conf/slam-rules.neon will be automatically included.

Otherwise you need to include conf/slam-rules.neon in your phpstan.neon:

Rules

  1. SlamPhpStan\UnusedVariableRule: check for variable inside functions never used after initial assignment
  2. SlamPhpStan\MissingClosureParameterTypehintRule: requires parameter typehints for closures; WARNING: no PhpDoc allowed, see phpstan/phpstan-strict-rules#87
  3. SlamPhpStan\StringToClassRule: requires strings that refer to classes to be expressed with ::class notation
  4. SlamPhpStan\GotoRule: no goto allowed
  5. SlamPhpStan\ClassNotationRule:
    1. Interfaces must end with "Interface"
    2. Traits must end with "Trait"
    3. Abstract classes must start with "Abstract"
    4. Exceptions must end with "Exception"
  6. SlamPhpStan\PhpUnitFqcnAnnotationRule: classes found in following PHPUnit annotations must exist:
    1. @expectedException
    2. @covers
    3. @coversDefaultClass
    4. @uses
  7. SlamPhpStan\AccessGlobalVariableWithinContextRule: inhibit the access to globals within classes that extend or implement a certain class/interface
  8. SlamPhpStan\AccessStaticPropertyWithinModelContextRule: inhibit the access to static attributes of a class within classes that extend or implement a certain class/interface, useful to prohibit usage of singletons in models

Not-NOW config

A not-now-rules.neon config is present for forbidding raw date system calls:

These rules forbid:

  1. new DateTimeImmutable()
  2. new DateTime('yesterday')
  3. date('Y-m-d')
  4. time()
  5. strtotime('noon')

You should instead rely on a clock abstraction like lcobucci/clock.

WARNING: the rules are not perfect, a user can tricks them easily; they are meant only to help the transition to a proper clock abstraction.

Symfony-specific config

A symfony-rules.neon config is present for Symfony projects:

With the following configurations:

  1. SlamPhpStan\SymfonyFilesystemRule: forbid calls to raw filesystem functions well wrapped by symfony/filesystem component
  2. SlamPhpStan\SymfonyProcessRule: forbid calls to raw system functions well wrapped by symfony/process component

Yii-specific config

A yii-rules.neon config is present for Yii projects:

With the following configurations:

  1. SlamPhpStan\AccessGlobalVariableWithinContextRule to deny the usage of $_GET, $_POST and other global variables in models implementing yii\db\ActiveRecordInterface: accessing to singletons in models is considered an anti-pattern
  2. SlamPhpStan\AccessStaticPropertyWithinModelContextRule to deny the usage of yii\BaseYii static variables like $app in models implementing yii\db\ActiveRecordInterface: accessing to singletons in models is considered an anti-pattern

All versions of phpstan-extensions with dependencies

PHP Build Version
Package Version
Requires php Version ~8.3.0 || ~8.4.0
phpstan/phpstan Version ^1.12.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package slam/phpstan-extensions contains the following files

Loading the files please wait ....