vishwac09/extended-php-guidelines
最新稳定版本:1.0.0
Composer 安装命令:
composer require vishwac09/extended-php-guidelines
包简介
Provides set of additional coding/style guidelines to sniff PHP code.
关键字:
README 文档
README
Apart from the PSR-1, PSR-2, PSR-12 and the Drupal standard's, we follow few more to achieve consistency of code project wide.
I work mostly on Drupal projects, so normally use the Drupal Coding standard to sniff the custom code for any violations. This PHP library is a type of PHP-CodeSniffer standard which checks PHP code against the below list.
List
- Order of imports -
Group Drupal/Symfony imports and third party libraries added via composer separately. - Avoid Switch case -
PHP >= 8.0 provides match() {} expression, can be replaced in place of switch() case:. - Avoid Static Class references -
Cannot be injected. - Order of member functions -
Order member function in ascending order, improves readability.
Usage
Create a project, and add this packages as DEV dependancy.
Installation
Add via composer as local dependencies
composer require --dev dealerdirect/phpcodesniffer-composer-installer
composer require --dev vishwac09/extended-php-guidelines
OR
Add via composer as global dependencies
composer require global --dev dealerdirect/phpcodesniffer-composer-installer
composer require global --dev vishwac09/extended-php-guidelines
Add via GIT
git clone git@github.com:vishwac09/extended-php-guidelines.git
add the standard to phpcs
phpcs --config-set installed_paths /path/to/extended-php-guidelines/EPG
Run
Check if the new stanadard is configures with phpcs.
phpcs -i
Sniff code for the above violation.
phpcs --standard=EPG --colors file1.php, file2.inc
Example
FILE: /Users/hp/Documents/temp.php
------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------
1 | WARNING | Group Drupal/Symfony imports and third party libraries added via composer separately.
26 | WARNING | Member functions of class must be defined in ascending order
28 | WARNING | Do not use static class references.
40 | WARNING | Member functions of interface must be defined in ascending order
50 | WARNING | Do not use switch expression. With PHP >= 8.0 use the new match expression
| | (https://www.php.net/manual/en/control-structures.match.php).
------------------------------------------------------------------------------------------------------
vishwac09/extended-php-guidelines 适用场景与选型建议
vishwac09/extended-php-guidelines 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「standards」 「phpcs」 「code review」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vishwac09/extended-php-guidelines 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vishwac09/extended-php-guidelines 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vishwac09/extended-php-guidelines 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
PHP_CodeSniffer custom Sniff for Laravel coding standard
A set of abstractions that define core services provided by the DVSA
This is the ZooRoyal coding standard.
Vanio Coding Standard Ruleset for PHP_CodeSniffer.
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2022-11-12