Download the PHP package glpi-project/phpstan-glpi without Composer

On this page you can find all versions of the php package glpi-project/phpstan-glpi. 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-glpi

PHPStan GLPI extension

This repository provides a PHPStan extension that can be used in both GLPI and GLPI plugins.

Installation

To install this PHPStan extension, run the composer require --dev glpi-project/phpstan-glpi.

To make this extension automatically enabled by PHPStan, you can also install the phpstan/extension-installer library, otherwise you will need to add it in you PHPStan configuration file in the includes section:

See https://phpstan.org/user-guide/extension-library#installing-extensions for more information.

Configuration

The PHPStan configuration depends on your GLPI version. If your plugin is located in either the plugins or marketplace directory of GLPI, you can use the following configuration file example:

The GLPI path and version should be detected automatically, but you can specify them in the parameters section of your PHPStan configuration:

See https://phpstan.org/config-reference fore more information about the PHPStan configuration options.

Analyser improvements

This extension will help PHPStan to resolve the GLPI global variables types. For instance, it will indicate that the global $DB; variable is an instance of the DBmysql class, so PHPStan will be able to detected bad method calls, deprecated methods usages, ...

Rules

ForbidDynamicInstantiationRule

Since GLPI 11.0.

Instantiating an object from an unrestricted dynamic string is unsecure. Indeed, it can lead to unexpected code execution and has already been a source of security issues in GLPI.

Before instantiating an object, a check must be done to validate that the variable contains an expected class string.

If the treatPhpDocTypesAsCertain PHPStan parameter is not set to false, a variable with a specific class-string type will be considered safe.

ForbidExitRule

Since GLPI 11.0.

Since the introduction of the Symfony framework in GLPI 11.0, the usage of exit()/die() instructions is discouraged. Indeed, they prevents the execution of post-request/post-command routines, and this can result in unexpected behaviours.

ForbidHttpResponseCodeRule

Since GLPI 11.0.

Due to a PHP bug (see https://bugs.php.net/bug.php?id=81451), the usage of the http_response_code() function, to define the response code, may produce unexpected results, depending on the server environment. Therefore, its usage is discouraged.

ForbidHardCodedRightNameRule

Since GLPI 12.0.

In the past, there have been issues where rights management was not handled correctly at the controller level due to the use of an obsolete hardcoded string. To avoid this type of problem, starting with GLPI 12, the use of a hardcoded string, as the first argument (module) of Session::checkRight(), Session::checkRightsOr(), Session::haveRight(), Session::haveRightsAnd(), or Session::haveRightsOr(), will be considered an error and must be replaced with the $rightname property of the appropriate class.

MissingGlobalVarTypeRule

Since GLPI 10.0.

By default, PHPStan is not able to detect the global variables types, and is therefore not able to detect any issue related to their usage. This extension will resolve the type of GLPI global variables, but cannot resolve your plugin specific global variables. To get around this limitation, we recommend that you declare each global variable type with a PHPDoc tag.


All versions of phpstan-glpi with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
phpstan/phpstan Version ^2.1
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 glpi-project/phpstan-glpi contains the following files

Loading the files please wait ...