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 Config Laravel Package

chameleon-system/code-style-config

Shared code style configuration for the Chameleon System PHP/Laravel ecosystem. Provides standardized formatting and linting rules (e.g., PHP-CS-Fixer/Pint setups) to keep multiple projects consistent, reduce review noise, and enforce team conventions.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require --dev chameleon-system/code-style-config
    

    Add to composer.json under require-dev if not auto-detected.

  2. First Use Case Integrate with PHP-CS-Fixer or PHPStan by extending their config files:

    // php-cs-fixer.dist.php
    $finder = PhpCsFixer\Finder::create()
        ->in(__DIR__.'/../src')
        ->exclude('vendor');
    
    return (new PhpCsFixer\Config())
        ->setRules(include __DIR__.'/vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php')
        ->setFinder($finder);
    
  3. Where to Look First

    • Check vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php for default rules.
    • Review phpstan.neon.dist (if provided) for static analysis presets.

Implementation Patterns

Workflow Integration

  1. Leverage as a Base Config Extend the package’s rules in your project’s config files:

    // Custom rules.php
    $rules = include __DIR__.'/vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php';
    $rules['array_syntax'] = ['syntax' => 'short']; // Override specific rules
    
  2. CI/CD Pipeline Add to GitHub Actions (example):

    - name: Run PHP-CS-Fixer
      run: vendor/bin/php-cs-fixer fix --rules-set=chameleon --dry-run
    
  3. IDE Integration

    • Use php-cs-fixer as a PHPStorm inspection tool (via Settings > Tools > PHP > Code Sniffer).
    • Point to the package’s ruleset for real-time feedback.
  4. Team Onboarding

    • Document the package as a mandatory dependency in CONTRIBUTING.md.
    • Example:

      "Run composer require chameleon-system/code-style-config to sync code style rules."


Gotchas and Tips

Pitfalls

  1. Rule Conflicts

    • The package may enforce strict PSR-12 rules (e.g., no_unused_imports). Test locally before CI runs.
    • Fix: Override rules explicitly in your config.
  2. Missing Documentation

    • No README or changelog found. Assume no backward compatibility guarantees.
    • Tip: Fork and document changes if critical to your project.
  3. Static Analysis Gaps

    • If phpstan.neon is missing, rely on PHP-CS-Fixer for basic style checks.
    • Workaround: Use phpstan/extension-installer to add missing presets.

Debugging

  • Rule Validation Run with --verbose to debug rule application:
    vendor/bin/php-cs-fixer fix --verbose --rules-set=chameleon
    
  • Isolated Testing Test a single file:
    vendor/bin/php-cs-fixer fix path/to/File.php
    

Extension Points

  1. Custom Rulesets Merge with existing rules:

    $rules = array_merge(
        include 'vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php',
        ['bracket_line_break' => true]
    );
    
  2. Dynamic Rule Loading Load rules from a config file (e.g., .php-cs-fixer-chameleon.php) for flexibility.

  3. PHPStan Integration If phpstan.neon is provided, extend it:

    includes:
        - vendor/chameleon-system/code-style-config/phpstan/level-5.neon
    
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.
terminal42/code-quality-tools
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