shipmonk/coding-standard
ShipMonk’s PHP coding standard built on PHP_CodeSniffer and Slevomat rules. Install as a dev dependency, add a phpcs.xml.dist referencing ShipMonkCodingStandard, then run phpcs to check code and phpcbf to auto-fix issues.
@template* annotation ordering, trait usage rules). Aligns with ShipMonk’s long-term goal of maintainable, high-quality codebases while reducing manual review overhead.@template* annotations) critical for ShipMonk’s roadmap, ensuring compatibility with upcoming Laravel releases and future-proofing the codebase.slevomat/coding-standard directly. Reduces maintenance burden by scoping the package to internal needs only.Adopt this package if:
Avoid this package if:
slevomat/coding-standard or PSR-12 directly instead.RequireSelfReference).phpstan, rector, or Laravel’s Pint), making PHPCS redundant or causing conflicts.*"This package standardizes our PHP and Laravel codebases across all ShipMonk projects, driving efficiency and quality at scale. By adopting ShipMonk’s pre-configured coding standard, we eliminate the need to reinvent linting rules, ensuring consistency without additional engineering overhead. This aligns with our long-term goals of maintaining high-quality, maintainable codebases while accelerating development velocity.
For projects outside ShipMonk’s ecosystem, we recommend using slevomat/coding-standard directly to avoid lock-in and ensure community support. This package is a strategic ‘buy’ decision—it leverages ShipMonk’s existing investment in coding standards, reducing our technical debt and improving collaboration across teams."*
*"This is ShipMonk’s official PHPCS ruleset—a turnkey solution to enforce our coding standards across Laravel and PHP projects. Here’s why it’s valuable:
To adopt:
composer require --dev shipmonk/coding-standard.phpcs.xml.dist with the provided template.vendor/bin/phpcs to catch issues or vendor/bin/phpcbf to auto-fix them.For non-ShipMonk projects, use slevomat/coding-standard directly, as this package is tailored exclusively for our internal use. If you encounter conflicts (e.g., Laravel-specific patterns), coordinate with the team to override rules in phpcs.xml or exclude directories as needed."
*"This package enforces ShipMonk’s coding standards for PHP/Laravel projects. Here’s how to use it:
composer require --dev shipmonk/coding-standard
phpcs.xml.dist:
<ruleset>
<arg name="basepath" value="."/>
<arg name="cache" value="var/phpcs.cache"/>
<file>src/</file>
<file>tests/</file>
<config name="installed_paths" value="vendor/slevomat/coding-standard,vendor/shipmonk/coding-standard"/>
<rule ref="ShipMonkCodingStandard"/>
</ruleset>
vendor/bin/phpcsvendor/bin/phpcbfKey notes:
@template* annotations) may differ from other standards.RequireSelfReference for PHPStan compatibility).Pro tip: Add this to your CI pipeline to enforce rules early and keep your codebase clean! Example GitHub Actions step:
- name: Run PHPCS
run: vendor/bin/phpcs --standard=ShipMonkCodingStandard --warning-severity=3
```"
### **For Technical Leads/Architects**
*"This package is a **monolithic, opinionated** PHPCS ruleset built for ShipMonk’s internal use. While it provides immediate standardization, its rigid design and ShipMonk-specific tweaks introduce tradeoffs:
**Pros:**
- **Fast adoption**: Ready-to-use with minimal configuration.
- **Toolchain alignment**: Works with ShipMonk’s PHPStan, Rector, and Laravel setup.
- **PHP 8.5 support**: Future-proofs your codebase for modern PHP features.
**Cons:**
- **Laravel limitations**: **No native Laravel support**—rules like `CatchExceptionsOrder` or `ThrowsAnnotationsOrder` may conflict with Laravel’s **middleware exception handling** or **Facade aliasing**.
- **Auto-fix risks**: `phpcbf` could reorder code in ways that break Laravel patterns (e.g., Facade imports, middleware).
- **Lock-in**: ShipMonk’s rules may conflict with Laravel’s idiomatic practices or other static analyzers.
**Recommendation:**
- Use this package **only for ShipMonk-owned projects** where alignment with internal conventions is critical.
- For external Laravel projects, use `slevomat/coding-standard` with a custom config or PSR-12.
- If adopting, test `phpcbf` thoroughly in a staging environment to avoid breaking changes.
- Consider adding a **pre-commit hook** or **CI check** to enforce rules without blocking development:
```bash
composer require --dev laravel-pint
vendor/bin/pint --test # Optional: Add Pint for Laravel-specific formatting
```"
How can I help you explore Laravel packages today?