synergitech/laravel-coding-standards
Composer 安装命令:
composer require --dev synergitech/laravel-coding-standards
包简介
A generic package for implementing Laravel Pint coding standards across Laravel packages
README 文档
README
A Composer package for implementing Laravel Pint coding standards across Laravel packages.
Overview
This package provides:
- A standardised
pint.jsonconfiguration file with PSR-12 preset and custom rules - Shell scripts to run Laravel Pint for code formatting and testing
- Automatic Laravel Pint dependency management through Composer
Installation
Via Composer (Recommended)
Install the package using Composer:
composer require synergitech/laravel-coding-standards --dev
This will automatically install Laravel Pint as a dependency and make the scripts available in your project.
Alternative Installation Methods
-
As a Git Submodule:
git submodule add https://github.com/SynergiTech/laravel-coding-standards.git tools/coding-standards
-
Manual Installation: Copy the files directly to your project and install Laravel Pint separately:
composer require laravel/pint --dev
Usage
Running Pint
Apply Code Formatting
To automatically fix coding standard issues:
./vendor/synergitech/laravel-coding-standards/pint
Or if installed as submodule/manually:
./tools/coding-standards/pint
# or
./pint
You can pass additional arguments to customise the behaviour:
./vendor/synergitech/laravel-coding-standards/pint --verbose ./vendor/synergitech/laravel-coding-standards/pint --dry-run ./vendor/synergitech/laravel-coding-standards/pint app/Models
Test Code Standards
To check for coding standard issues without making changes:
./vendor/synergitech/laravel-coding-standards/pint-test
Or if installed as submodule/manually:
./tools/coding-standards/pint-test
# or
./pint-test
You can pass additional arguments to customise the testing:
./vendor/synergitech/laravel-coding-standards/pint-test --verbose ./vendor/synergitech/laravel-coding-standards/pint-test app/Controllers
Adding Scripts to Your Composer.json
For easier access, you can add these scripts to your project's composer.json:
{
"scripts": {
"pint": "./vendor/synergitech/laravel-coding-standards/pint",
"pint:test": "./vendor/synergitech/laravel-coding-standards/pint-test"
}
}
Then run:
composer run pint # Apply formatting composer run pint:test # Test standards
Boost Guidelines
As this plugin acts as a wrapper for pint, the boost guidelines that get published into the project do not reference this package.
If you use boost then you will need to override the boost guidelines for pint.
If you want this package to publish boost guideline stubs into your project (.ai/guidelines), add the Composer install script override below to your project's composer.json:
{
"scripts": {
"post-install-cmd": [
"SynergiTech\\LaravelCodingStandards\\ComposerScripts::publishGuidelines"
]
}
}
After adding it, run:
composer install
This triggers SynergiTech\LaravelCodingStandards\ComposerScripts::publishGuidelines and copies the guideline files into .ai/guidelines which boost will interpret as an overwrite when running boost:install and boost:update.
Configuration
The pint.json file includes:
- PSR-12 preset as the base standard
- Custom rules for enhanced code quality
- Exclusion of common directories (vendor, storage, bootstrap/cache)
Custom Rules Included
- Array syntax and indentation improvements
- Multiline comment alignment
- String concatenation with single space
- Strict type comparisons
- Ordered class elements and imports
- Modern PHP syntax preferences
- And many more quality-of-life improvements
For a full list of rules, see the pint.json configuration file.
Requirements
- PHP ^8.1
- Laravel Pint ^1.0 (automatically installed with this package)
License
This package is open-sourced software licensed under the MIT license.
synergitech/laravel-coding-standards 适用场景与选型建议
synergitech/laravel-coding-standards 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 7.19k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「php-cs-fixer」 「coding-standards」 「psr-12」 「code-quality」 「Pint」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 synergitech/laravel-coding-standards 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 synergitech/laravel-coding-standards 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 synergitech/laravel-coding-standards 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Spatie's Laravel & PHP coding guidelines for Laravel Boost
HiDev plugin for PHP-CS-Fixer
Coding standards rule sets for Pimcore 4 and Pimcore 5
Taptima PHP-CS-Fixer fixers
The Polder Knowledge coding standards for PHP_CodeSniffer.
Axa Zara PHP Code style configuration for `php-cs-fixer` based on PSR-12.
统计信息
- 总下载量: 7.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-22