eckinox/eckinox-cs
Composer 安装命令:
composer require eckinox/eckinox-cs
包简介
A very opinionated CS/linting setup for PHP projects.
README 文档
README
Getting started
To add the coding standards checkers and linters to your PHP project, follow the instructions below:
- Make sure you don't have any uncommited files in your project.
This package will add files to your project, so you'll likely want to commit all of these all at once. - Add the package to your project with Composer using the command below:
composer require --dev eckinox/eckinox-cs
The package will automatically add all of the configuration files and utility scripts you'll need to your project. - Follow any additional instructions provided in the CLI.
- Run the following command to install Javascript dependencies:
npm install
- Ensure scripts are executable:
chmod +x DEV/**/*
- Commit the files to your project:
git add --a && git commit -m "Adds coding standards and linting checks via eckinox/eckinox-cs"
- Enjoy!
What's included
This package is a like a metapackage, but with a little sugar on top.
Not only does it add other PHP dependencies via Composer, but it also:
- Adds JS dependencies.
- Creates configuration files.
- Adds shell scripts to facilitate usage of the tools.
- Adds a Git pre-commit hook.
- Adds a Github actions workflow.
Here's a bit of information about all of that.
Tools and packages
Here are the tools that are included and configured in this package:
| Tool | Config | Git-aware |
|---|---|---|
| EditorConfig Helps maintain consistent coding styles across various editors and IDEs. |
.editorconfig |
N/A |
| PHP-CS-Fixer A tool to automatically fix PHP Coding Standards issues |
.php_cs.dist |
✅ |
| PHPStan PHP Static Analysis Tool - discover bugs in your code without running it! |
phpstan.neon |
✅ |
| PHPMD PHP Mess Detector |
.phpmd.xml |
✅ |
| Twig-CS-Fixer The missing checkstyle for twig! |
.twig-cs-fixer.dist.php |
❌ |
| ESLint Find and fix problems in your JavaScript code |
.eslintrc.json .eslintignore |
❌ |
| CSS stylelint A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. |
.stylelintrc.json |
❌ |
The Git-aware column indicates tools whose provided execution script (located in DEV/cs/) will only take into account staged files, instead of running on every file in your project every time.
Configuration files
The packge creates configuration files for every tool it adds.
These configuration files match Eckinox's coding standards, and should not be changed manually.
Changed files could be overwritten in later updates of eckinox/eckinox-cs.
Pre-commit hook for Git
The package includes a pre-commit script that will execute all of the provided tools to check for potential errors and non-standard code.
If you don't have a pre-commit script already, the package will automatically set up this one (as a symbolic link) when you install the package.
If you already have a pre-commit, you will have to merge the two manually.
Another pre-commit script ( pre-commit-with-bypass ) is available if you need to be able to commit when somes test fail. After each tool if some test fail, the script will ak if you want to continue. The script need to be installed manually.
Github actions workflow
To ensure your project is always respecting the standards, this package adds a workflow for Github Actions that runs every included tool on your codebase.
This allows project members and maintainers to view the status of every branch and pull request, right in Github.
Authentication for private repositories
If you are using private Github repositories via Composer, set up the secrets for HTTP authentication as described in php-actions/composer's documentation.
The workflow included by eckinox-cs already includes the steps necessary to retrieve and use that authentication token, if it is present.
eckinox/eckinox-cs 适用场景与选型建议
eckinox/eckinox-cs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.21k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 eckinox/eckinox-cs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eckinox/eckinox-cs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-20