drupol/phpcsfixer-configs-drupal
Composer 安装命令:
composer require drupol/phpcsfixer-configs-drupal
包简介
Base PHP CS Fixer configurations for Drupal 7 and 8.
README 文档
README
PHP CS Fixer Drupal Configurations
Description
This package provides a set [PHP-Cs-Fixer](https://github.com/FriendsOfPHP/PHP CS Fixer) configuration objects ready to be used in a Drupal project.
Documentation
Available configuration objects:
drupol\PhpCsFixerConfigsDrupal\Config\Drupal7drupol\PhpCsFixerConfigsDrupal\Config\Drupal8
Requirements
- PHP >= 8.0
- friendsofphp/php-cs-fixer >= 3.35
Installation
The recommended way to install PHP CS Fixer Drupal is to use Composer in a dedicated composer.json file in your project, for example in the tools/php-cs-fixer directory:
mkdir -p tools/php-cs-fixer composer require --dev --working-dir=tools/php-cs-fixer drupol/phpcsfixer-configs-drupal
Or using the main composer.json:
composer require --dev drupol/phpcsfixer-configs-drupal
Configuration
Assuming you installed PHP CS Fixer as instructed above, you should now setup a configuration .php-cs-fixer.php file in the root directory of your project.
touch .php-cs-fixer.php
The example below setup PHP CS Fixer to use Drupal 8/9/10 rules:
<?php use drupol\PhpCsFixerConfigsDrupal\Config\Drupal8; $finder = PhpCsFixer\Finder::create() ->in(['web/modules/custom']) ->name('*.module') ->name('*.inc') ->name('*.install') ->name('*.test') ->name('*.profile') ->name('*.theme') ->notPath('*.md') ->notPath('*.info.yml') ; $config = new Drupal8(); $config->setFinder($finder); $rules = $config->getRules(); $config->setRules($rules); return $config;
See the PHP CS Fixer documentation on how to use the advanced configuration object.
Usage
Assuming you installed PHP CS Fixer as instructed above, you can run the following command to fix your Drupal project:
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix
Code quality, tests and benchmarks
Every time changes are introduced into the library, Github Actions run the tests and the benchmarks.
The library has tests written with PHPUnit.
Feel free to check them out in the tests directory. Run ./vendor/bin/phpunit to trigger the tests.
Before each commit some inspections are executed with GrumPHP, run ./vendor/bin/grumphp run to check manually.
Contributing
Feel free to contribute to this library by sending Github pull requests. I'm quite reactive :-)
drupol/phpcsfixer-configs-drupal 适用场景与选型建议
drupol/phpcsfixer-configs-drupal 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 280.42k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2019 年 07 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 drupol/phpcsfixer-configs-drupal 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 drupol/phpcsfixer-configs-drupal 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 280.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 39
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-19