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

Code Style Laravel Package

ibexa/code-style

Ibexa coding standards bundle: PHP-CS-Fixer internal config factory, rulesets, CI/IDE helpers, hooks and contribution templates. Install as a dev dependency and add a .php-cs-fixer.php to apply Ibexa style, with optional parallel runs.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Purpose Alignment: The package enforces Ibexa’s PHP coding standards via PHP CS Fixer, which aligns with Laravel’s focus on maintainability and consistency. It integrates natively with Laravel’s existing tooling (e.g., php-cs-fixer, Git hooks) without disrupting core architecture.
  • Rule Customization: The InternalConfigFactory enables TPMs to extend Ibexa’s ruleset with Laravel-specific conventions (e.g., PSR-12 overrides, Blade template rules) or override conflicting rules (e.g., Ibexa DXP-specific directives). This flexibility ensures compatibility with Laravel’s ecosystem while maintaining Ibexa’s standards.
  • Toolchain Synergy: Complements Laravel’s ecosystem (e.g., Laravel Pint, Laravel Valet) by providing a standardized ruleset for teams transitioning from Ibexa DXP or adopting Ibexa’s conventions. It avoids redundancy with Laravel’s built-in tools while enhancing code quality.

Integration Feasibility

  • Minimal Setup: Requires only a .php-cs-fixer.php configuration file and a Composer dependency (ibexa/code-style), making integration trivial. No database migrations, service providers, or route changes are needed.
  • CI/CD Readiness: Designed for seamless CI/CD integration (e.g., GitHub Actions, GitLab CI) with support for Git hooks. Can be integrated into Laravel’s phpunit.xml or standalone workflows, enabling pre-commit checks or post-merge validations.
  • IDE Compatibility: Supports IDE plugins (PHPStorm, VSCode) via .php-cs-fixer.dist.php, enabling real-time linting and reducing manual review overhead.

Technical Risk

  • Rule Conflicts: Ibexa’s rules may conflict with Laravel’s defaults (e.g., namespace alignment, class/method ordering, or Blade template conventions). Mitigation: Use $factory->withRules() to override or supplement Ibexa’s ruleset, ensuring alignment with Laravel’s conventions.
  • Versioning Risks: The package does not follow strict SemVer BC, guaranteeing compatibility only within a minor release. Mitigation: Use the recommended ~X.Y.Z Composer constraint (e.g., ~2.2.0) to limit disruption from patch updates. Monitor minor releases for breaking changes.
  • Dependency Locking: The package locks PHP CS Fixer to specific versions (e.g., v3.95.1), which may lag behind the latest features or bug fixes. Mitigation: Evaluate whether the locked version meets current needs or if customization is required.
  • Licensing Complexity: Dual licensing (Ibexa BUL + GPL-2.0) may complicate adoption in proprietary or open-source projects. Mitigation: Verify compliance with project licensing requirements and ensure alignment with Ibexa’s BUL terms if using Ibexa DXP.

Key Questions

  1. Rule Compatibility: Are Ibexa’s coding standards compatible with Laravel’s existing conventions (e.g., Blade templates, Facade usage, or custom PSR overrides)? If not, how will conflicts be resolved?
  2. Customization Needs: Does the team require additional rules beyond Ibexa’s defaults (e.g., Laravel-specific linting for Blade files or custom annotations)? If so, how will these be integrated?
  3. CI/CD Strategy: How will the package be integrated into the CI pipeline (e.g., pre-commit hooks, post-merge checks, or pull request validations)? Will it replace or supplement existing tools (e.g., Laravel Pint)?
  4. Maintenance Plan: Given the non-SemVer BC promise, how will the team handle minor release updates? Will automated testing or rollback procedures be implemented?
  5. IDE Adoption: Will the team adopt IDE integration (e.g., PHPStorm’s built-in PHP CS Fixer), and if so, how will conflicts between local and CI configurations be managed?
  6. Performance Impact: Could parallel execution (runInParallel()) be enabled to reduce CI/CD runtime for large codebases?
  7. Documentation Gaps: Are there unclear aspects of the package’s usage (e.g., custom rule overrides, IDE setup) that require additional documentation or training?

Integration Approach

Stack Fit

  • Laravel Compatibility: The package is fully compatible with Laravel’s PHP-based stack, including:
    • Core PHP: Applies to Laravel’s PHP files (e.g., app/, src/, tests/).
    • Blade Templates: While primarily focused on PHP, the package can be extended to include Blade-specific rules (e.g., via custom PHP CS Fixer rules).
    • Dependencies: Integrates with Composer and Laravel’s dev dependencies without conflicts.
  • Toolchain Alignment: Works alongside Laravel’s existing tools:
    • PHP CS Fixer: Can coexist or replace Laravel Pint if Ibexa’s ruleset is preferred.
    • PHPStan: Complements static analysis by focusing on code style rather than logic.
    • Git Hooks: Supports pre-commit/pre-push hooks for local enforcement.
  • IDE Support: Compatible with PHPStorm, VSCode, and other IDEs via PHP CS Fixer plugins, enabling real-time linting.

Migration Path

  1. Assessment Phase:
    • Audit existing .php-cs-fixer.dist.php or custom rules to identify conflicts with Ibexa’s standards.
    • Run Ibexa’s default ruleset locally to preview changes:
      composer require --dev ibexa/code-style
      vendor/bin/php-cs-fixer fix --dry-run --diff
      
  2. Pilot Integration:
    • Add the package to a non-critical branch or module:
      composer require --dev ibexa/code-style:~2.2.0
      
    • Configure .php-cs-fixer.php using Ibexa’s factory (with or without custom rules).
    • Test in CI by adding a step to validate style compliance (e.g., fail builds on violations).
  3. Customization:
    • Override Ibexa’s rules where necessary (e.g., for Laravel-specific conventions):
      $factory->withRules([
          '@PSR12' => true, // Merge with PSR-12 if needed
          'ordered_imports' => false, // Disable if conflicting
      ]);
      
    • Extend for Blade templates or other Laravel-specific files by modifying the Finder:
      $config->setFinder(
          Finder::create()
              ->in(__DIR__ . '/resources/views')
              ->name('*.blade.php')
      );
      
  4. Full Rollout:
    • Merge pilot changes into main and update CI/CD pipelines to enforce the new ruleset.
    • Train the team on using php-cs-fixer locally and interpreting output.

Compatibility

  • Laravel Versions: Compatible with Laravel 8+ (PHP 7.4+) and Laravel 9/10 (PHP 8.0+). No framework-specific dependencies.
  • PHP CS Fixer: Locks to specific versions (e.g., v3.95.1), which may require customization if newer features are needed.
  • IDE/Editor: Works with any editor supporting PHP CS Fixer (e.g., PHPStorm, VSCode with PHP CS Fixer extension).
  • CI Systems: Agnostic to CI platform (GitHub Actions, GitLab CI, Jenkins) but requires PHP CS Fixer to be installed in the environment.

Sequencing

  1. Phase 1: Local Adoption (1–2 weeks):
    • Add the package to local environments and configure .php-cs-fixer.php.
    • Run locally to preview changes and address conflicts.
  2. Phase 2: CI Integration (1 week):
    • Add PHP CS Fixer to CI pipelines as a validation step.
    • Configure to fail builds on style violations.
  3. Phase 3: Customization (Ongoing):
    • Refine rules for Laravel-specific needs (e.g., Blade templates, Facades).
    • Document overrides for the team.
  4. Phase 4: Enforcement (1 week):
    • Enable pre-commit hooks (e.g., Husky) for local enforcement.
    • Gradually increase CI strictness (e.g., warn → fail).

Operational Impact

Maintenance

  • Dependency Updates: Minor releases may introduce breaking changes (e.g., new PHP CS Fixer rules). Mitigation:
    • Use ~X.Y.Z Composer constraints to limit updates to patch releases.
    • Test new minor releases in a staging environment before upgrading.
  • Rule Updates: Ibexa may update rules to align with PHP CS Fixer or DXP changes. Mitigation:
    • Monitor the changelog for rule changes.
    • Customize rules where necessary to maintain compatibility.
  • Tooling Dependencies: PHP CS Fixer itself may require updates. Mitigation:
    • Pin PHP CS Fixer to a specific version if stability is critical.
    • Use the package’s locked versions to avoid surprises.

Support

  • Troubleshooting: Common issues include:
    • Rule conflicts (resolved via $factory->withRules()).
    • IDE misconfigurations (resolved via .php-cs-fixer.dist.php).
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.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php