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

Hidev Php Cs Fixer Laravel Package

hiqdev/hidev-php-cs-fixer

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation:

    composer require hiqdev/hidev-php-cs-fixer
    

    Ensure hiqdev/hidev is also installed as a dependency.

  2. Enable the Plugin: Add to .hidev/config.yml:

    plugins:
      - hiqdev/hidev-php-cs-fixer
    
  3. First Use Case: Run the php-cs-fixer command via HiDev:

    hidev php-cs-fixer fix
    

    This generates a .php_cs config file (if missing) and applies fixes to your codebase.


Implementation Patterns

Workflows

  1. Integrate with HiDev Commands: Use the plugin’s built-in commands for common tasks:

    # Fix all files in the project
    hidev php-cs-fixer fix
    
    # Check files without fixing
    hidev php-cs-fixer check
    
    # Stop a running fix (if needed)
    hidev php-cs-fixer stop-fix
    
  2. Customize .php_cs Config: The plugin auto-generates a .php_cs file in your project root. Override it by:

    • Manually editing the file (e.g., to exclude specific rules).
    • Using HiDev’s config system to extend the default template:
      # .hidev/config.yml
      hiqdev/hidev-php-cs-fixer:
        config:
          rules:
            - '@PSR2'
            - 'no_unused_imports'
            - 'concat_space'
          finder:
            - path: 'src'
            - path: 'tests'
      
  3. CI/CD Integration: Add to your CI pipeline (e.g., GitHub Actions):

    - name: Run PHP-CS-Fixer
      run: hidev php-cs-fixer check
    
  4. Pre-Commit Hooks: Use with tools like pre-commit to enforce consistency:

    # .pre-commit-config.yaml
    repos:
      - repo: local
        hooks:
          - id: php-cs-fixer
            name: PHP-CS-Fixer
            entry: hidev php-cs-fixer check
            language: system
            pass_filenames: false
    

Gotchas and Tips

Pitfalls

  1. Outdated HiDev Compatibility:

    • The package is last updated for HiDev v2 (2017). Ensure your hiqdev/hidev version matches the plugin’s requirements.
    • If using newer HiDev versions, check for breaking changes in the HiDev docs.
  2. Config File Overrides:

    • The plugin auto-generates .php_cs on first run. Manual edits may be overwritten. Use HiDev’s config system (as shown above) for customizations.
  3. Cache File Ignoring:

    • The plugin ignores .php_cs.cache in VCS (e.g., .gitignore). Ensure this file is excluded to avoid bloating your repo.
  4. Command Path Issues:

    • The plugin runs php-cs-fixer from the project root. If you encounter path errors, verify:
      • php-cs-fixer is installed globally or via Composer (composer require friendsofphp/php-cs-fixer).
      • The hidev command is executed from the correct directory.

Debugging Tips

  1. Verbose Output: Use --verbose for debugging:

    hidev php-cs-fixer fix --verbose
    
  2. Dry Runs: Test changes without modifying files:

    hidev php-cs-fixer check --dry-run
    
  3. Custom Rules: Extend the default rules by merging with the plugin’s config:

    # .hidev/config.yml
    hiqdev/hidev-php-cs-fixer:
      config:
        rules:
          '@Symfony': true
          'array_syntax': 'short'
    

Extension Points

  1. Custom Templates: Override the .php_cs template by extending the plugin’s config:

    # .hidev/config.yml
    hiqdev/hidev-php-cs-fixer:
      template: 'path/to/custom/php_cs.template'
    
  2. Post-Fix Hooks: Use HiDev’s after hooks to run additional tasks post-fix:

    # .hidev/config.yml
    hooks:
      after:
        'php-cs-fixer/fix':
          - 'git add .'
          - 'git commit -m "Apply PHP-CS-Fixer fixes"'
    
  3. Parallel Processing: For large codebases, leverage PHP-CS-Fixer’s parallel mode via the config:

    hiqdev/hidev-php-cs-fixer:
      config:
        parallel: true
    
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