Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Conventions Laravel Package

ecphp/php-conventions

Predefined GrumPHP configuration for PHP projects at the European Commission. Adds quality checks via git hooks (or manual runs): license file, composer validation/normalization, linters (YAML/JSON/PHP), Twig CS, PHP-CS-Fixer, PHPCS, PHPStan, Psalm.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Still No Laravel-Specific Value: The package remains a generic PHP conventions enforcer (PSR-12, naming rules) with zero Laravel-specific enhancements (Eloquent, Blade, routes, or controller validation). This release (1.0.2) introduces no architectural or functional improvements for Laravel users, reinforcing its role as a supplementary tool rather than a core Laravel solution.
  • Static Analysis Remains Generic: No new Laravel-centric rules or integrations were added. The package continues to overlap with existing tools like Laravel Pint or PHPStan’s Laravel extension without differentiation.
  • Housekeeping-Only Release: The commits (ECPHP-179, .gitattributes) are non-functional, confirming the package’s stagnation. No breaking changes or new features were introduced.

Integration Feasibility

  • Unchanged Low Barrier to Entry: Integration remains trivial as a PHPCS/PHPStan rule set, but the lack of Laravel-specific features reduces its utility in Laravel workflows.
  • Persistent Conflicts: Risks of rule clashes with Laravel’s dynamic properties, magic methods (__get, __set), or existing tooling (e.g., nunomaduro/collision) remain unresolved.
  • Manual Customization Still Required: Teams must still manually exclude Laravel-specific patterns (e.g., $fillable, protected $guarded) to avoid false positives.

Technical Risk

  • Increased Maintenance Risk: The package’s inactivity since 2022 and reliance on outdated dependencies (e.g., PHPCS/PHP-CS-Fixer) heighten compatibility risks with modern PHP (8.2+) and Laravel (10+).
  • No Mitigation for Laravel Issues: The release does not address false positives/negatives in Laravel codebases, leaving teams to handle exclusions manually.
  • Dependency Risks Unresolved: No updates to core dependencies (e.g., php-cs-fixer:^3.0, phpunit/phpunit), increasing CI/CD pipeline failures.

Key Questions

  1. Strategic Justification:

    • With no new Laravel-specific features, why adopt this package over Laravel Pint, PHPStan’s Laravel ruleset, or Pest’s built-in checks?
    • Are there unresolved gaps in existing tools that this package could theoretically fill (e.g., custom DTO/repository naming)?
  2. Alignment with Team Standards:

    • How does this package’s rule set compare to the team’s current phpcs.xml.dist/phpstan.neon configurations?
    • Are there Laravel-specific exceptions (e.g., allowing protected $guarded) requiring manual overrides?
  3. Maintenance Commitment:

    • Given the package’s inactivity, who will handle updates if dependencies (e.g., php-cs-fixer:^3.0) become incompatible with newer PHP/Laravel versions?
    • Is there a plan to fork and maintain this package proactively?
  4. Integration Validation:

    • How will the package be tested in the Laravel codebase (e.g., CI pipeline, local development)?
    • Are there existing tests for Laravel-specific edge cases (e.g., dynamic properties, Blade templates)?
  5. Performance Impact:

    • Will static analysis slow down CI/CD pipelines compared to existing tools (e.g., Laravel Pint)?
    • Are there plans to optimize or parallelize execution?

Integration Approach

Stack Fit

  • PHPCS/PHPStan Integration:

    • Remains a custom rule set with no Laravel-specific features, limiting its value to generic PSR-12 enforcement.
    • Example configuration (unchanged):
      <!-- phpcs.xml.dist -->
      <config defaultStandard="PSR12">
          <ruleSetPath>vendor/ecphp/php-conventions/ruleset.xml</ruleSetPath>
      </config>
      
      <!-- phpstan.neon -->
      includes:
          - vendor/ecphp/php-conventions/extension.neon
      
  • CI/CD Pipeline:

    • Run as a pre-commit hook or CI step, but prioritize Laravel Pint for Laravel-specific linting.
    • Example GitHub Actions step (unchanged):
      - name: Run PHP Conventions
        run: vendor/bin/phpcs --standard=vendor/ecphp/php-conventions
      
  • IDE Integration:

    • Configure PHPStorm/VSCode to use the package’s rules, but expect limited Laravel-specific feedback.

Migration Path

  1. Audit Existing Codebase:

    • Run the package’s linter to identify violations and document exceptions (e.g., ignore __get() in controllers).
    • Use --ignore flags to exclude problematic files initially.
  2. Incremental Adoption:

    • Start with non-critical modules (e.g., feature branches) before enforcing globally.
    • Supplement with existing tools (e.g., Laravel Pint for Blade/Eloquent checks).
  3. Toolchain Alignment:

    • Disable overlapping rules in other tools (e.g., PSR-12 in PHPCS if this package covers them).
    • Example: Exclude redundant rules in phpcs.xml.dist:
      <rule ref="PSR12">
          <exclude name="Classes.PropertyDeclaration.Underscore"/>
      </rule>
      
  4. Custom Rule Overrides:

    • Fork the package to add Laravel-specific exclusions (e.g., allow protected $fillable).
    • Publish as a private package (e.g., company/php-conventions-laravel).

Compatibility

  • PHP/Laravel Version Support:

    • Test compatibility with the team’s PHP version (e.g., 8.1 vs. 8.2) and Laravel version (e.g., 9.x vs. 10.x).
    • Action Required: Fork and update dependencies (e.g., php-cs-fixer:^3.0^4.0) if incompatibilities arise.
  • Toolchain Conflicts:

    • Disable overlapping rules in other tools (e.g., Laravel Pint, PHPStan).
    • Example: In phpstan.neon, exclude conflicting rules:
      excludes:
          - app/Models/*.php
      
  • Laravel-Specific Edge Cases:

    • Test with:
      • Dynamic properties (e.g., $model->relation).
      • Magic methods (e.g., __call, __set).
      • Blade templates (if supported).

Sequencing

  1. Proof of Concept (PoC):

    • Integrate in a throwaway branch and validate:
      • False positive/negative rate.
      • Performance impact in CI.
      • Developer experience (e.g., IDE feedback).
  2. Configuration Hardening:

    • Customize rules to ignore Laravel-specific patterns.
    • Example: Add to phpcs.xml.dist:
      <file>app/Models/*.php</file>
      <exclude name="Classes.PropertyDeclaration.Underscore"/>
      
  3. CI/CD Rollout:

    • Add to CI as a required check (block PR merges on failures).
    • Gradually increase strictness (e.g., start with warnings, then errors).
  4. Documentation:

    • Update team docs with:
      • List of enforced rules and exceptions.
      • How to disable rules for specific cases.
      • Troubleshooting guide for common false positives.

Operational Impact

Maintenance

  • Dependency Updates:

    • Critical Risk: Package is unmaintained; require manual updates to dependencies (e.g., php-cs-fixer, phpunit/phpunit).
    • Mitigation: Fork the repo and schedule quarterly updates to align with PHP/Laravel versions.
  • Rule Maintenance:

    • Effort: Medium. Rules may need tweaking as Laravel evolves (e.g., new features in Laravel 11+).
    • Example: Exclude new magic methods or Laravel-specific patterns (e.g., #[Spatial] attributes).
  • Toolchain Drift:

    • Risk: Other tools (e.g., PHPStan, Laravel Pint) may change, requiring reconfiguration.
    • Mitigation: Regularly audit rule overlaps and deprecate redundant tools.

Support

  • Debugging Complexity:

    • Challenge: Hard to debug why Laravel-specific patterns are flagged (e.g., "Why is my __get() method failing?").
    • Solution: Document common exceptions and provide a README snippet for the team.
  • Onboarding:

    • Effort: Low for developers familiar with PHPCS/PHPStan. High for those unfamiliar with static analysis.
    • Mitigation: Include a 15-minute onboarding session with examples of Laravel-specific rules.
  • Community Support:

    • Risk: No active community or issue tracker. Problems may go unanswered.
    • Mitigation: Use GitHub Issues for the forked repo or internal Slack channel.

Scaling

  • Performance:
    • Impact: Static analysis adds overhead to CI/CD pipelines (e.g., +30–60 seconds per run).
    • Mitigation:
      • Cache results (e.g., phpcs --cache).
      • Run in parallel with other checks (e.g., unit tests).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor