kaiseki/php-coding-standard
Composer 安装命令:
composer require kaiseki/php-coding-standard
包简介
Shared PHP-CS-Fixer, PHPStan and CI config for Kaiseki PHP packages
README 文档
README
Shared coding-standard tooling for all kaiseki/* packages: a PHP-CS-Fixer config and a shared
PHPStan config.
The composer package is kaiseki/php-coding-standard; the GitHub repository is
kaisekidev/php-coding-standards. (CI lives separately — see below.)
Installation
composer require --dev kaiseki/php-coding-standard
PHP-CS-Fixer
Add the following .php-cs-fixer.dist.php file to your project's root. This creates a basic
configuration with a Finder that includes everything in . and excludes vendor:
<?php declare(strict_types=1); use Kaiseki\CodingStandard\PhpCsFixer\Config; return Config::get();
If you need a more granular directory specification, you can pass a custom Finder. You can also override rules by passing your own as the second argument:
<?php declare(strict_types=1); use Kaiseki\CodingStandard\PhpCsFixer\Config; use PhpCsFixer\Finder; $finder = Finder::create() ->in(__DIR__ . '/src'); $rules = [ // Your custom rules here ]; return Config::get($finder, $rules);
PHPStan
Include the shared PHPStan config from your package's root phpstan.neon and add only your own
paths:
includes: - vendor/kaiseki/php-coding-standard/phpstan/kaiseki.neon parameters: paths: - src - tests
The shared config runs at level: max. The rule extensions (phpstan-strict-rules,
phpstan-phpunit, phpstan-wordpress, phpstan-safe-rule, phpstan-psr-container) are auto-registered
via phpstan/extension-installer.
Note:
pathsmust live in each package's rootphpstan.neon, not in the shared config. Relative paths in a neon file resolve against the file's own directory (i.e.vendor/...), not the consuming package root.
Composer scripts
Add these scripts to your composer.json. The reusable CI workflow (below) invokes them by name,
so every package is expected to define them:
{
"scripts": {
"cs-check": "php-cs-fixer fix --dry-run",
"cs-fix": "php-cs-fixer fix --allow-risky=yes",
"phpstan": "phpstan analyse",
"phpunit": "phpunit",
"check-deps": "composer-require-checker"
}
}
Continuous integration
CI logic is maintained in one place — a reusable workflow in the kaisekidev/.github repo
(.github/workflows/checks.yml). Each package only needs a thin caller. Copy this to
.github/workflows/checks.yml in your package:
name: Checks on: pull_request: push: branches: [master] jobs: checks: uses: kaisekidev/.github/.github/workflows/checks.yml@v1
The workflow runs check-deps, cs-check, phpstan, and phpunit across the supported PHP
matrix (default ["8.2","8.3","8.4"]) with a strict 100% coverage gate by default. Packages not
yet at full coverage override per-package via coverage-threshold: 0 or run-tests: false. The
@v1 ref is a moving major tag maintained on kaisekidev/.github.
kaiseki/php-coding-standard 适用场景与选型建议
kaiseki/php-coding-standard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.87k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kaiseki/php-coding-standard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kaiseki/php-coding-standard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 40
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-11