blumilksoftware/codestyle
Composer 安装命令:
composer require blumilksoftware/codestyle
包简介
Blumilk codestyle configurator
README 文档
README
blumilksoftware/codebase
A common codestyle helper for all Blumilk projects.
Usage
Add package to our project:
composer require blumilksoftware/codestyle --dev
Then run following to create configuration file and add scripts to the composer.json file:
./vendor/bin/codestyle init
Or you can create codestyle.php file in your project's root directory:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; return new Config();
Configuration
You can configure paths and rules in Config class constructor:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths; $paths = new LaravelPaths(); $config = new Config( paths: $paths->filter("app", "tests")->add("src"), ); return $config->config();
Or:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths; $config = new Config( paths: new LaravelPaths(LaravelPaths::LARAVEL_8_PATHS), ); return $config->config();
Or:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; use Blumilk\Codestyle\Configuration\Defaults\Paths; $config = new Config( paths: new Paths("src"), ); return $config->config();
Usage with Composer
Add scripts to your composer.json file:
{
"scripts": {
"cs": "./vendor/bin/php-cs-fixer fix --dry-run --diff --config codestyle.php",
"csf": "./vendor/bin/php-cs-fixer fix --diff --config codestyle.php"
}
}
Then run following command to check codestyle:
composer cs
or following to fix found errors:
composer csf
Additional configuration
If you want to disable risky rules, you can add withoutRiskyFixers method to the config file:
return $config->withoutRiskyFixers()->config();
If you want to enable ignoring marked file, you can add ignoreMarkedFiles method to the config file:
return $config->ignoreMarkedFiles()->config();
and then add // php-cs-fixer:ignore-file to the file which you want to ignore.
Upgrading guide
Upgrading guide is available in upgrading.md file.
Contributing
In cloned or forked repository, run:
cp .env.example .env composer install
There are scripts available for package codestyle checking and testing:
| Command | Description |
|---|---|
composer cs |
Runs codestyle against the package itself |
composer csf |
Runs codestyle with fixer enabled against the package itself |
composer test |
Runs all test cases |
composer unit |
Runs tests for package features |
composer e2e |
Runs tests for codestyle rules |
There is also the Docker Compose configuration available:
docker compose up -d docker compose exec php php -v docker compose exec php composer -V
There are also Makefile commands available:
make run make shell make stop
Please maintain our project guidelines:
- keep issues well described, labeled and in English,
- add issue number to all your commits,
- add issue number to your branch name,
- squash your commits into one commit with standardized name.
blumilksoftware/codestyle 适用场景与选型建议
blumilksoftware/codestyle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34.08k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2021 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 blumilksoftware/codestyle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 blumilksoftware/codestyle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 34.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 1
- 依赖项目数: 10
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-10
