chiiya / laravel-code-style
Laravel项目的代码风格和质量配置
3.0.0
2024-06-06 09:04 UTC
Requires
- php: ^8.2
- chiiya/code-style-php: ^3.0
- illuminate/contracts: ^11.0
- larastan/larastan: ^2.9
- phpro/grumphp: ^2.5
- spatie/laravel-package-tools: ^1.16
- tightenco/tlint: ^9.2
Requires (Dev)
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^9.0
- dev-master
- 3.0.0
- 2.3.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.0
- 1.9.0
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-5
- dev-dependabot/github_actions/actions/checkout-4
- dev-dependabot/github_actions/ramsey/composer-install-2
This package is auto-updated.
Last update: 2024-09-06 09:49:49 UTC
README
Laravel代码风格
使用PHP-CS-Fixer、ECS和Rector的组合为Laravel项目配置代码风格。
索引
> Installation ..................................................................... > Usage ............................................................................
安装
使用Composer安装包。当提示创建GrumPHP配置文件时,选择“否”。
composer require chiiya/laravel-code-style --dev
使用
# Publish config files php artisan vendor:publish --tag="code-style-config"
接下来,调整您项目文件夹中刚刚创建的ecs.php
、.php-cs-fixer.dist.php
、rector.php
和phpstan.neon
文件,以适应您的项目结构。
发布配置文件后,您可能需要重新初始化GrumPHP
php ./vendor/bin/grumphp git:deinit php ./vendor/bin/grumphp git:init
GrumPHP配置默认包含PHP-CS-Fixer、ECS和TLint的任务。由于它们可能需要很长时间,因此不包括rector
和phpstan
的任务。您可以选择单独执行它们(例如,在CI管道中),或者如果可以接受较长的等待时间,可以将它们添加到GrumPHP配置中
grumphp.yml
的示例
grumphp: tasks: # ... rector: ~ phpstan: ~
CI配置的示例(在您的管道中的某个位置调用这些)
./vendor/bin/ecs check ./vendor/bin/php-cs-fixer fix --dry-run --diff ./vendor/bin/rector process --dry-run ./vendor/bin/tlint lint ./vendor/bin/phpstan analyse --memory-limit=2G