{"id":20313878,"url":"https://github.com/craftcms/ecs","last_synced_at":"2025-08-23T16:08:27.672Z","repository":{"id":56958619,"uuid":"466566169","full_name":"craftcms/ecs","owner":"craftcms","description":"Easy Coding Standard configurations for Craft CMS projects.","archived":false,"fork":false,"pushed_at":"2024-08-07T21:54:46.000Z","size":27,"stargazers_count":17,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-13T07:28:40.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craftcms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-05T20:57:19.000Z","updated_at":"2024-10-14T16:42:10.000Z","dependencies_parsed_at":"2024-06-18T18:31:36.979Z","dependency_job_id":"33e7c099-759f-426c-95fa-fd005b9f5ef9","html_url":"https://github.com/craftcms/ecs","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":"0.33333333333333337","last_synced_commit":"3823f989668e12a85ba681f8c7f3fd8488e23066"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/craftcms/ecs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Fecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Fecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Fecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Fecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craftcms","download_url":"https://codeload.github.com/craftcms/ecs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Fecs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271746949,"owners_count":24813598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T18:13:20.218Z","updated_at":"2025-08-23T16:08:27.644Z","avatar_url":"https://github.com/craftcms.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easy Coding Standard config for Craft CMS\n\nThis package provides [Easy Coding Standard](https://github.com/symplify/easy-coding-standard) configurations for Craft CMS plugins and projects.\n\nIn general, we follow the [PSR-12](https://www.php-fig.org/psr/psr-12/) coding style guide, with a couple alterations:\n\n- Multi-line function argument rules aren’t enforced. ([¶4.4](https://www.php-fig.org/psr/psr-12/#44-methods-and-functions))\n- Spaces after the `function` keyword aren’t enforced. ([¶7](https://www.php-fig.org/psr/psr-12/#7-closures))\n- Visibility is not enforced for constants, for Craft 3 projects.\n\nTo install, run the following commands within your plugin or project:\n\n```sh\ncomposer config minimum-stability dev\n```\n\n```sh\ncomposer config prefer-stable true\n```\n\n```sh\ncomposer require craftcms/ecs:dev-main --dev\n```\n\nThen add an `ecs.php` file to the root of your plugin or project:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nuse craft\\ecs\\SetList;\nuse Symplify\\EasyCodingStandard\\Config\\ECSConfig;\n\nreturn static function(ECSConfig $ecsConfig): void {\n    $ecsConfig-\u003eparallel();\n    $ecsConfig-\u003epaths([\n        __DIR__ . '/src',\n        __FILE__,\n    ]);\n\n    $ecsConfig-\u003esets([SetList::CRAFT_CMS_3]); // for Craft 3 projects\n    $ecsConfig-\u003esets([SetList::CRAFT_CMS_4]); // for Craft 4 projects\n};\n```\n\nAdjust the `PATHS` value to include all source/test code locations, and remove the appropriate `SetList` option,\ndepending on whether this is for Craft 3 or Craft 4.\n\nWith that in place, you can check your plugin/project’s code with the following command:\n\n```sh\nvendor/bin/ecs check\n```\n\nAnd to automatically fix it as well, pass the `--fix` argument:\n\n```sh\nvendor/bin/ecs check --fix\n```\n\nYou might also want to define `check-cs` and `fix-cs` scripts in `composer.json`:\n\n```json\n{\n  \"...\": \"...\",\n  \"scripts\": {\n    \"check-cs\": \"ecs check --ansi\",\n    \"fix-cs\": \"ecs check --ansi --fix\"\n  }\n}\n```\n\nThen you could execute ECS using `composer run-script`:\n\n```sh\ncomposer run-script check-cs\ncomposer run-script fix-cs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftcms%2Fecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraftcms%2Fecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftcms%2Fecs/lists"}