phpstan/extension-installer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phpstan/extension-installer

Composer 安装命令:

composer require --dev phpstan/extension-installer

包简介

Composer plugin for automatic installation of PHPStan extensions

README 文档

README

Build Latest Stable Version License

Composer plugin for automatic installation of PHPStan extensions.

Motivation

diff --git a/phpstan.neon b/phpstan.neon
index db4e3df32e..2ca30fa20a 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,12 +1,3 @@
-includes:
-	- vendor/phpstan/phpstan-doctrine/extension.neon
-	- vendor/phpstan/phpstan-doctrine/rules.neon
-	- vendor/phpstan/phpstan-nette/extension.neon
-	- vendor/phpstan/phpstan-nette/rules.neon
-	- vendor/phpstan/phpstan-phpunit/extension.neon
-	- vendor/phpstan/phpstan-phpunit/rules.neon
-	- vendor/phpstan/phpstan-strict-rules/rules.neon
-
 parameters:
 	autoload_directories:
 		- %rootDir%/../../../build/SlevomatSniffs
diff --git a/composer.json b/composer.json
index 1b578dd624..f6ebf6e477 100644
--- a/composer.json
+++ b/composer.json
@@ -142,6 +142,7 @@
 		"jakub-onderka/php-parallel-lint": "1.0.0",
 		"justinrainbow/json-schema": "5.2.8",
 		"ondrejmirtes/mocktainer": "0.8",
+		"phpstan/extension-installer": "^1.0",
 		"phpstan/phpstan": "^0.11.7",
 		"phpstan/phpstan-doctrine": "^0.11.3",
 		"phpstan/phpstan-nette": "^0.11.1",

Usage

composer require --dev phpstan/extension-installer

Starting from Composer 2.2.0 you'll get the following question:

phpstan/extension-installer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "phpstan/extension-installer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?]

Answer with y to allow the plugin.

Instructions for extension developers

It's best (but optional) to set the extension's composer package type to phpstan-extension for this plugin to be able to recognize it and to be discoverable on Packagist.

Add phpstan key in the extension composer.json's extra section:

{
  "extra": {
    "phpstan": {
      "includes": [
        "extension.neon"
      ]
    }
  }
}

Console output

After each composer install or composer update, the plugin reports per-package status when the configuration changes:

  • installed — the extension was successfully registered.
  • not supported — a package has phpstan in its name but is not configured as a PHPStan extension (missing the phpstan-extension type and extra.phpstan key). This may indicate the package requires manual includes configuration.
  • ignored — the extension was skipped due to the ignore list (see below).

Ignoring a particular extension

You may want to disable auto-installation of a particular extension to handle installation manually. Ignore an extension by adding an extra.phpstan/extension-installer.ignore array in composer.json that specifies a list of packages to ignore:

{
  "extra": {
    "phpstan/extension-installer": {
      "ignore": [
        "phpstan/phpstan-phpunit"
      ]
    }
  }
}

Limitations

The extension installer depends on Composer script events, therefore you cannot use --no-scripts flag.

phpstan/extension-installer 适用场景与选型建议

phpstan/extension-installer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 107.86M 次下载、GitHub Stars 达 502, 最近一次更新时间为 2019 年 04 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「static analysis」 「dev」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 phpstan/extension-installer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 phpstan/extension-installer 我们能提供哪些服务?
定制开发 / 二次开发

基于 phpstan/extension-installer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 107.86M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 506
  • 点击次数: 19
  • 依赖项目数: 8880
  • 推荐数: 15

GitHub 信息

  • Stars: 502
  • Watchers: 5
  • Forks: 31
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-25