spaze/phpcs-phar
Composer 安装命令:
composer require --dev spaze/phpcs-phar
包简介
PHP_CodeSniffer phar releases, automated and always up-to-date
关键字:
README 文档
README
This repo contains phar releases of PHPCSStandards/PHP_CodeSniffer.
The files are downloaded from the PHP_CodeSniffer release pages, and if changed, they're commited and a release is created with the same version number as the upstream release.
The whole thing is powered by a GitHub Actions workflow.
I have created this for my personal usage to overcome the performance issues of the 9P filesystem as used by WSL2. The PHPCSStandards organization is also planning to create a Composer phar release so this repository will cease to exist one day, either when the official Composer phar is released, or when the 9P performace is sufficient, or when I retire. Consider yourself warned.
Installation
Install with Composer:
composer require --dev spaze/phpcs-phar
Installing coding standards
The phar releases in this repository do not work with the PHP_CodeSniffer Standards Composer Installer Plugin (the dealerdirect/phpcodesniffer-composer-installer package).
Be warned that this package even replaces the installer plugin in its composer.json.
There are several reasons for that:
- The installer plugin looks for a different installed package,
squizlabs/php_codesnifferto add more standards to - The plugin creates a configuration file with a relative path to the standard being installed, so the code sniffer then expects the standard to be present inside the phar file, which is not the case
However, there are multiple different ways to install a standard. Let's say you want to add slevomat/coding-standard, you can:
Auto-install the available standards
If the CodeSniffer.conf file doesn't exist, this package will find and auto-install all available coding standards on each execution.
The altered configuration is not persisted, no config file will be created, because it would be removed on each package update anyway.
This is the recommended option emulating the Standards Composer Installer Plugin to a certain point. The performance is comparable to
using the installer plugin as only Composer metadata are used to find the installed coding standards.
Modify the config file
- In your project, run
vendor/bin/phpcs --config-set installed_paths ../../slevomat/coding-standard - Locate the
CodeSniffer.conffile in yourvendor/spaze/phpcs-phardirectory - Edit the path to the installed standard and make it an absolute path, for example change
'installed_paths' => '../../slevomat/coding-standard'
to'installed_paths' => __DIR__ . '/../../slevomat/coding-standard'
Please be aware that the CodeSniffer.conf file will be removed on each package update.
Install the standard using an absolute path
In your project, run
vendor/bin/phpcs --config-set installed_paths $(realpath vendor/slevomat/coding-standard)
or use any absolute path for the installed_paths value.
Please be aware that the CodeSniffer.conf file will be removed on each package update.
spaze/phpcs-phar 适用场景与选型建议
spaze/phpcs-phar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.97k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「dev」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 spaze/phpcs-phar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 spaze/phpcs-phar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 spaze/phpcs-phar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Monolog bridge for PHP Debugbar
Simple and fast methods to read private properties and call private methods
Analysis module for finding problematical shop data.
Analysis module for finding problematical shop data.
Enforce architecture by defining modules with allowed dependencies. Detects forbidden, uncovered, missing and unused module dependencies in PHP projects.
Analysis module for finding problematical shop data.
统计信息
- 总下载量: 5.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2024-01-26