Product Decisions This Supports
- Enforce Consistent Code Quality: Adopt Spryker Code Sniffer to standardize PHP code quality across teams, reducing technical debt and improving maintainability. Aligns with PSR-2 and PSR-12 while adding Spryker-specific rules (e.g., method annotations, namespace conventions).
- Accelerate Onboarding: Reduce ramp-up time for new developers by enforcing a single coding standard, minimizing "why is this written this way?" discussions.
- CI/CD Integration: Automate code quality checks in pull requests and merge gates to block non-compliant code early, improving release velocity.
- Customization for Legacy Systems: Gradually migrate legacy codebases by silencing or excluding rules during transition (e.g., PHP 7.4 → 8.2 deprecations).
- Stricter Standards for New Projects: Use the
SprykerStrict standard for greenfield projects to enforce best practices from day one.
- IDE Integration: Embed linting/fixing into developer workflows (e.g., PHPStorm shortcuts) to catch issues before they reach version control.
- Compliance with Enterprise Policies: Meet internal security/audit requirements by enforcing license headers, namespace conventions, and deprecated function checks.
- Roadmap for PHP 8+ Adoption: Phase out PHP 7.4+ deprecated features via configurable rules (e.g.,
SprykerDisallowFunctions with version pinning).
When to Consider This Package
- Avoid if:
- Your team already uses a mature, maintained alternative (e.g., PHP-CS-Fixer, PSR12-specific tools, or custom in-house sniffs).
- You’re not using Laravel/Spryker (rules are optimized for Spryker’s architecture, e.g.,
FacadeMethodAnnotation, QueryContainer checks).
- Your project is small/non-critical and lacks CI/CD pipelines (overhead may not justify benefits).
- You need minimalist linting (this package includes ~100+ rules; consider PHP_CodeSniffer alone for lighter needs).
- Look Elsewhere if:
- You require JavaScript/TypeScript linting (use ESLint).
- Your stack is non-PHP (e.g., Node.js, Python).
- You need automated refactoring (combine with PHP-CS-Fixer or Rector).
- You’re locked into strict PSR-12 only (this extends beyond PSR standards).
- Consider When:
- Migrating from custom linting rules to a standardized approach.
- Onboarding multiple teams with divergent coding styles.
- Enforcing Spryker-specific patterns (e.g., service locators, entity managers).
- Preparing for PHP 8.2+ with built-in deprecation checks.
How to Pitch It (Stakeholders)
For Executives:
"This package standardizes our PHP codebase to Spryker’s best practices, reducing bugs and onboarding time by 30%. By integrating it into CI/CD, we’ll catch issues early—saving QA and tech debt costs. It’s low-risk (MIT license) and future-proofs our code for PHP 8+ migrations."
Key Outcomes:
✅ Faster releases (fewer last-minute fixes).
✅ Lower maintenance costs (consistent, readable code).
✅ Scalable hiring (developers write code "the Spryker way").
✅ Audit-ready (enforces license headers, security checks).
For Engineering Leaders:
*"Spryker Code Sniffer gives us automated enforcement of our coding standards—no more manual reviews. It’s extensible (we can add/remove rules) and integrates seamlessly with:
- CI pipelines (blocks bad PRs).
- IDE tooling (fixes issues on save).
- Legacy migrations (gradual rule adoption).
It’s not just linting—it’s a guardrail for our architecture (e.g., validating Facade/Repository annotations). Let’s pilot it in [Team X] and measure dev velocity improvements."*
Tech Benefits:
🔧 Unified standards (PSR-2 + Spryker-specific).
🔧 Fixable errors (auto-corrects formatting, spacing).
🔧 Customizable (silence rules during transitions).
🔧 PHP 8+ ready (configurable deprecation checks).
For Developers:
*"This tool saves you time by:
- Auto-fixing 80% of style issues (
console code:sniff:style -f).
- Catching bugs early (e.g., wrong namespace, missing annotations).
- Working in your IDE (PHPStorm shortcuts to lint/fix on demand).
- Supporting your workflow (CI fails fast, no surprises in PRs).
Example:
# Run in your project:
composer require --dev spryker/code-sniffer
./vendor/bin/console code:sniff:style -f # Fixes errors
Pro Tip: Add it to your .gitignore for vendor/ but never ignore the rules—they’re here to help!"*