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

Coding Standard Laravel Package

lmc/coding-standard

Deprecated PHP coding standard for Alma Career Czechia (formerly LMC). Based on PSR-12 and partially PER 2.0, delivered via EasyCodingStandard with rules for PHP-CS-Fixer and PHP_CodeSniffer to enforce readable, consistent code and catch common mistakes.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the package as a dev dependency:

    composer require --dev lmc/coding-standard
    

    ⚠️ Critical note: This package is archived and deprecated. For new projects, use its official replacement: almacareer/coding-standard. Only use this legacy package if maintaining older codebases stuck on lmc/coding-standard.

  2. Create ecs.php in your project root to load the standard:

    <?php declare(strict_types=1);
    
    use Symplify\EasyCodingStandard\Config\ECSConfig;
    
    return ECSConfig::configure()
        ->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
        ->withRootFiles()
        ->withSets([__DIR__ . '/vendor/lmc/coding-standard/ecs.php']);
    
  3. Run checks immediately:

    vendor/bin/ecs check
    

Implementation Patterns

  • Integrate into CI & Composer workflows:
    Add to composer.json scripts for consistent usage:

    "scripts": {
        "analyze": "vendor/bin/ecs check --ansi",
        "fix": "vendor/bin/ecs check --ansi --fix"
    }
    

    Run composer analyze before commits; composer fix for auto-correction.

  • Extend with project-specific rules using withRules() and withConfiguredRule():

    ->withRules([
        SingleLineCommentSpacingFixer::class,
        PhpUnitAttributesFixer::class, // (for PHPUnit 10+)
    ])
    ->withConfiguredRule(LineLengthSniff::class, ['absoluteLineLimit' => 120]);
    
  • Suppress rules selectively with withSkip() for edge cases:

    ->withSkip([
        ForbiddenFunctionsSniff::class => [__DIR__ . '/src-tests/bootstrap.php'],
        __DIR__ . '/legacy/*.php',
    ]);
    
  • Leverage version-specific behavior:
    This package auto-loads rules appropriate for your runtime PHP version (e.g., PHP 8.1 features only run on PHP ≥8.1). Ensure CI and local dev use matching PHP versions.

Gotchas and Tips

  • ⚠️ Deprecated & locked dependencies:

    • Version 4.1.2 restricts php-cs-fixer to <3.65.0 due to a critical bug in NullableTypeDeclarationFixer.
    • Avoid upgrading beyond lmc/coding-standard 4.x – the repo is abandoned. Migrate to almacareer/coding-standard ASAP.
  • Configuration breaking changes in v4.0.0:

    • Replaced YAML config with PHP (ecs.php only).
    • Dropped ecs-7.4.php, ecs-8.0.php, etc. — use a single ecs.php.
    • Switched base standard from PSR-2 → PSR-12.
  • PHPDoc alignment issues:
    Version 4.1.1 disabled PhpdocAlignFixer due to incorrect behavior. Avoid re-enabling it unless thoroughly tested.

  • IDE integration pitfalls:
    PHPStorm will only pick up fixes if your ecs.php is in the root and correctly referenced. Use the IDE guide — but note this package uses older ECS versions (v9/v12) — ensure compatibility.

  • Testing parity matters:
    Since v4.0.0, the project includes test suites for its own sniffs. If extending the standard, ensure your project also tests fixers to avoid regressions.

  • Beware of PHP version drift:
    If your project supports multiple PHP versions (e.g., 8.0–8.3), lmc/coding-standard only applies applicable rules — but fixer behavior may differ across versions. Run checks with the lowest supported PHP version in CI to avoid false passes.

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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope