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

cartalyst/php-cs-fixer-config

Reusable PHP-CS-Fixer configuration from Cartalyst. Provides a shared rule set and presets to standardize coding style across projects, making formatting consistent and easy to apply in CI and local development.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer (composer require --dev cartalyst/php-cs-fixer-config), then create or update .php-cs-fixer.php in your project root:

<?php

require __DIR__ . '/vendor/autoload.php';

return Cartalyst\PhpCsFixer\Config::create();

Run ./vendor/bin/php-cs-fixer fix --dry-run to preview changes. This immediately enforces Cartalyst’s internal standards—ideal for new or legacy Cartalyst ecosystem projects.

Implementation Patterns

  • Base config for monorepos: In a monorepo, create per-package .php-cs-fixer.php files that call Cartalyst\PhpCsFixer\Config::create() and selectively override rules (e.g., ->setRule('visibility_required', false) for test suites).
  • CI pipeline integration: Use in GitHub Actions with vendor/bin/php-cs-fixer fix . --config=.php-cs-fixer.php --using-cache=no and fail on non-compliant code.
  • Pre-commit hook: Integrate with tools like husky (via Node) or overcommit (Ruby) to auto-fix staged files before commit.
  • Laravel-specific extension: Even if targeting Laravel, use this as a strict baseline and override rules like 'yoda_style' => false or 'phpdoc_var_without_name' => false to align with Laravel conventions.

Gotchas and Tips

  • Unknown source risk: With no public repository or Packagist entry, verify compatibility manually—ensure friendsofphp/php-cs-fixer is installed and pinned to a version this config supports (e.g., v3.x).
  • Rule quirks: Cartalyst’s config may enforce stricter than Laravel defaults (e.g., explicit visibility on properties). Run --diff first to audit changes before committing.
  • No version guarantees: Avoid ^1.0 or loose version constraints—pin to a SHA or exact version if the package is available, to prevent silent rule changes.
  • Extend, don’t fork: Override rules in your local config class (e.g., create App\PhpCsFixer\Config extends Cartalyst\PhpCsFixer\Config) instead of editing vendor files.
  • Debugging fails: If fixers misbehave, run with --verbose and check PHP version compatibility (e.g., union types require PHP 8.0+, but older fixer versions may mishandle them).
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport