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

Ecs Laravel Package

craftcms/ecs

Easy Coding Standard (ECS) config presets for Craft CMS projects and plugins. PSR-12 aligned with a few Craft-specific tweaks. Install via Composer, add an ecs.php selecting Craft 3 or 4 set, then run ecs check (optionally --fix).

View on GitHub
Deep Wiki
Context7

Easy Coding Standard config for Craft CMS

This package provides Easy Coding Standard configurations for Craft CMS plugins and projects.

In general, we follow the PSR-12 coding style guide, with a couple alterations:

  • Multi-line function argument rules aren’t enforced. (¶4.4)
  • Spaces after the function keyword aren’t enforced. (¶7)
  • Visibility is not enforced for constants, for Craft 3 projects.

To install, run the following commands within your plugin or project:

composer config minimum-stability dev
composer config prefer-stable true
composer require craftcms/ecs:dev-main --dev

Then add an ecs.php file to the root of your plugin or project:

<?php

declare(strict_types=1);

use craft\ecs\SetList;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function(ECSConfig $ecsConfig): void {
    $ecsConfig->parallel();
    $ecsConfig->paths([
        __DIR__ . '/src',
        __FILE__,
    ]);

    $ecsConfig->sets([SetList::CRAFT_CMS_3]); // for Craft 3 projects
    $ecsConfig->sets([SetList::CRAFT_CMS_4]); // for Craft 4 projects
};

Adjust the PATHS value to include all source/test code locations, and remove the appropriate SetList option, depending on whether this is for Craft 3 or Craft 4.

With that in place, you can check your plugin/project’s code with the following command:

vendor/bin/ecs check

And to automatically fix it as well, pass the --fix argument:

vendor/bin/ecs check --fix

You might also want to define check-cs and fix-cs scripts in composer.json:

{
  "...": "...",
  "scripts": {
    "check-cs": "ecs check --ansi",
    "fix-cs": "ecs check --ansi --fix"
  }
}

Then you could execute ECS using composer run-script:

composer run-script check-cs
composer run-script fix-cs
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
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