synergitech/laravel-coding-standards
最新稳定版本:v1.1.0
Composer 安装命令:
composer require 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
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.
统计信息
- 总下载量: 2.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-22