arispati/phpcs-pre-commit
Composer 安装命令:
composer require arispati/phpcs-pre-commit
包简介
Run phpcs before git commit
README 文档
README
Run phpcs before git commit
Table of Contents
Requirement
- PHP >= ^8.2 | ^8.3
- Laravel >= ^10.0 | ^11.0
Installation
- Add this command to your composer.json on script section at
post-install-cmdandpost-update-cmdattribute
@php artisan arispati:phpcs-install
// composer.json { ... "scripts": { "post-install-cmd": [ "@php artisan arispati:phpcs-install" ], "post-update-cmd": [ "@php artisan arispati:phpcs-install" ], }, ... }
- Then install the package with composer
composer require --dev arispati/phpcs-pre-commit
- Now when you commit the changes and got an error, its look like this
[PRE-COMMIT] Running PHP_CodeSniffer using the PSR12 standard E 1 / 1 (100%) FILE: ...~/HomeController.php -------------------------------------------------------------------------------- FOUND 5 ERRORS AFFECTING 4 LINES -------------------------------------------------------------------------------- 11 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 4 11 | ERROR | [x] Expected 1 space after closing parenthesis; found newline 12 | ERROR | [x] Line indented incorrectly; expected at least 8 spaces, found 4 13 | ERROR | [x] Line indented incorrectly; expected at least 12 spaces, found 8 14 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 4 -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- Time: 138ms; Memory: 10MB [PRE-COMMIT] Please fix all of the violations or commit with the --no-verify option
Uninstall
- Run this command to remove git hook script
php artisan arispati:phpcs-uninstall
- Remove composer script
@php artisan arispati:phpcs-installbothpost-install-cmdandpost-update-cmdattribute - Then remove the package with composer
composer remove --dev arispati/phpcs-pre-commit
arispati/phpcs-pre-commit 适用场景与选型建议
arispati/phpcs-pre-commit 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 228 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 06 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 arispati/phpcs-pre-commit 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arispati/phpcs-pre-commit 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 228
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-07