webifycms/dev-tools
Composer 安装命令:
composer require webifycms/dev-tools
包简介
Set of development tools to analyze and auto fix code standards, formatting and other stuffs for WebifyCMS packages.
README 文档
README
Set of development tools to analyze and auto-fix code standards, formatting and other stuff for WebifyCMS packages.
The following libraries are included:
friendsofphp/php-cs-fixerphpstan/phpstanrector/rectorsymfony/var-dumper
Installation
Install via composer
composer require webifycms/dev-tools --dev
Configuration
- PHP CS Fixer
You can add the rules and finder instance in the following way to your config file .php-cs-fixer.php:
use Webify\Tools\Fixer; use PhpCsFixer\Finder; // create a finder instance according to your needs $finder = Finder::create()->in(__DIR__ . '/src'); // add the rules and it will override the defaults $rules = []; return (new Fixer($finder, $rules))->getConfig();
- PHPStan
Add phpstan.neon in the root directory, and include the default config like below:
includes: - vendor/webifycms/dev-tools/phpstan-default.neon
- Rector
Add rector.php in the root directory and the following, if you need to add more paths, you can add them as well:
use Webify\Tools\Rector; // Initialize return (new Rector()) ->initialize([ __DIR__ . '/src', __DIR__ . '/test' ]) ->withPhpSets(php81: true);
Usage
- Analyze your code first with PHPStan static analyzer for errors and fix (manual fix):
vendor/bin/phpstan analyse [options] [<paths>...]
Additionally, add the following to your phpstan.neon file to enable installed PHPStan extensions:
includes: - vendor/phpstan/phpstan-strict-rules/rules.neon - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-deprecation-rules/rules.neon
- Run code sniffer and format your codes.
(Recommended) If you wish to fix manually, you can just output the rules that will apply like the following.
./vendor/bin/php-cs-fixer fix --verbose --diff --show-progress=dots --dry-run
If you wish to auto-fix the files and output the summary of changes, you can run the following.
./vendor/bin/php-cs-fixer fix --verbose --show-progress=dots
Upgrade code with RectorPHP
# to output the changes only ./vendor/bin/rector process --dry-run # to make the changes ./vendor/bin/rector process
Debugging
The symfony/var-dumper package is included and provides the dump() and dd() helper functions for inspecting
variables during development.
e.g. use dump() within your .php-cs-fixer.php or rector.php config files to inspect the resolved configuration:
use Webify\Tools\Fixer; use PhpCsFixer\Finder; $finder = Finder::create()->in(__DIR__ . '/src'); $config = (new Fixer($finder))->getConfig(); // Inspect the merged rules before returning dump($config->getRules()); return $config;
e.g. use dd() function (dump and die) to halt execution after dumping:
$config = (new Fixer($finder))->getConfig(); dd($config->getRules());
Testing
Run unit tests with PHPUnit:
vendor/bin/phpunit
NOTE: You can also set up this extension with your favorite IDE or editor, so you can get more advantages like format on save while developing.
TODO
- Install
phpstan/phpstanlibrary. - Install Rector
rector/rectorlibrary. - Add alias commands for the library commands, like the following:
# ./vendor/bin/php-cs-fixer fix --verbose --diff --show-progress=dots --dry-run composer sniff # ./vendor/bin/php-cs-fixer fix --verbose --show-progress=dots composer code-format # ./vendor/bin/phpstan composer analyse
- Add support to pass arguments to the alias commands.
webifycms/dev-tools 适用场景与选型建议
webifycms/dev-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 87 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 10 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 webifycms/dev-tools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webifycms/dev-tools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 87
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-31