{"id":23220878,"url":"https://github.com/deprecated-packages/easy-coding-standard-prefixed","last_synced_at":"2025-08-19T10:32:07.518Z","repository":{"id":52199288,"uuid":"232914176","full_name":"deprecated-packages/easy-coding-standard-prefixed","owner":"deprecated-packages","description":"[READ-ONLY] Prefixed version of ECS to prevent install conflicts on older version","archived":false,"fork":false,"pushed_at":"2021-05-07T09:45:23.000Z","size":1027039,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-29T00:26:08.467Z","etag":null,"topics":["coding-standard","ecs","php-code-sniffer","php-cs-fixer","prefixed","psr-12"],"latest_commit_sha":null,"homepage":"https://github.com/symplify/easy-coding-standard","language":"PHP","has_issues":false,"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/deprecated-packages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-09T21:59:57.000Z","updated_at":"2021-05-07T10:31:16.000Z","dependencies_parsed_at":"2022-08-24T14:01:08.764Z","dependency_job_id":null,"html_url":"https://github.com/deprecated-packages/easy-coding-standard-prefixed","commit_stats":null,"previous_names":["symplify/easy-coding-standard-prefixed"],"tags_count":204,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2Feasy-coding-standard-prefixed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2Feasy-coding-standard-prefixed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2Feasy-coding-standard-prefixed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2Feasy-coding-standard-prefixed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deprecated-packages","download_url":"https://codeload.github.com/deprecated-packages/easy-coding-standard-prefixed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230345997,"owners_count":18211999,"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","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":["coding-standard","ecs","php-code-sniffer","php-cs-fixer","prefixed","psr-12"],"created_at":"2024-12-18T22:14:19.978Z","updated_at":"2024-12-18T22:14:20.552Z","avatar_url":"https://github.com/deprecated-packages.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Easiest Way to Use Any Coding Standard\n\n[![Downloads total](https://img.shields.io/packagist/dt/symplify/easy-coding-standard.svg?style=flat-square)](https://packagist.org/packages/symplify/easy-coding-standard/stats)\n\n![ECS-Run](docs/run-and-fix.gif)\n\n## Features\n\n- Use [PHP_CodeSniffer || PHP-CS-Fixer](https://tomasvotruba.com/blog/2017/05/03/combine-power-of-php-code-sniffer-and-php-cs-fixer-in-3-lines/) - anything you like\n- **2nd run under few seconds** with un-changed file cache\n- Skipping files for specific checkers\n- Prepared sets - PSR12, Symfony, Common, Array, Symplify and more...\n- [Prefixed version](https://github.com/symplify/easy-coding-standard-prefixed) in case of conflicts on install\n\nAre you already using another tool?\n\n- [How to Migrate From PHP_CodeSniffer to EasyCodingStandard in 7 Steps](https://www.tomasvotruba.com/blog/2018/06/04/how-to-migrate-from-php-code-sniffer-to-easy-coding-standard/#comment-4086561141)\n- [How to Migrate From PHP CS Fixer to EasyCodingStandard in 6 Steps](https://www.tomasvotruba.com/blog/2018/06/07/how-to-migrate-from-php-cs-fixer-to-easy-coding-standard/)\n\n## Install\n\n```bash\ncomposer require symplify/easy-coding-standard --dev\n```\n\n### Prefixed Version\n\nThe prefix verion can be used when there are dependancy clashes. Head over to the\n[\"Easy Coding Standard Prefixed\" repository](https://github.com/symplify/easy-coding-standard-prefixed) for more information.\n\n```bash\ncomposer require symplify/easy-coding-standard-prefixed --dev\n```\n\n## Usage\n\n### 1. Create Configuration and Setup Checkers\n\n- Create an `ecs.php` in your root directory\n- Add [Sniffs](https://github.com/squizlabs/PHP_CodeSniffer)\n- ...or [Fixers](https://github.com/FriendsOfPHP/PHP-CS-Fixer) you'd love to use\n\n```php\n// ecs.php\nuse PhpCsFixer\\Fixer\\ArrayNotation\\ArraySyntaxFixer;\nuse Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator;\nuse Symplify\\EasyCodingStandard\\ValueObject\\Set\\SetList;\n\nreturn static function (ContainerConfigurator $containerConfigurator): void {\n    // A. standalone rule\n    $services = $containerConfigurator-\u003eservices();\n    $services-\u003eset(ArraySyntaxFixer::class)\n        -\u003ecall('configure', [[\n            'syntax' =\u003e 'short',\n        ]]);\n\n    // B. full sets\n    $containerConfigurator-\u003eimport(SetList::PSR_12);\n};\n```\n\n### 2. Run in CLI\n\n```bash\n# dry\nvendor/bin/ecs check src\n\n# fix\nvendor/bin/ecs check src --fix\n```\n\n## Features\n\nHow to load own config?\n\n```bash\nvendor/bin/ecs check src --config another-config.php\n```\n\n## Configuration\n\nConfiguration can be extended with many options. Here is list of them with example values and little description what are they for:\n\n```php\nuse PhpCsFixer\\Fixer\\ArrayNotation\\ArraySyntaxFixer;\nuse Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator;\nuse Symplify\\EasyCodingStandard\\ValueObject\\Option;\n\nreturn static function (ContainerConfigurator $containerConfigurator): void {\n    $parameters = $containerConfigurator-\u003eparameters();\n\n    // alternative to CLI arguments, easier to maintain and extend\n    $parameters-\u003eset(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);\n\n    // run single rule only on specific path\n    $parameters-\u003eset(Option::ONLY, [\n        ArraySyntaxFixer::class =\u003e [__DIR__ . '/src/NewCode'],\n    ]);\n\n    $parameters-\u003eset(Option::SKIP, [\n        // skip paths with legacy code\n        __DIR__ . '/packages/*/src/Legacy',\n\n        ArraySyntaxFixer::class =\u003e [\n            // path to file (you can copy this from error report)\n            __DIR__ . '/packages/EasyCodingStandard/packages/SniffRunner/src/File/File.php',\n\n            // or multiple files by path to match against \"fnmatch()\"\n            __DIR__ . '/packages/*/src/Command',\n        ],\n\n        // skip rule completely\n        ArraySyntaxFixer::class,\n\n        // just single one part of the rule?\n        ArraySyntaxFixer::class . '.SomeSingleOption',\n\n        // ignore specific error message\n        'Cognitive complexity for method \"addAction\" is 13 but has to be less than or equal to 8.',\n    ]);\n\n    // scan other file extendsions; [default: [php]]\n    $parameters-\u003eset(Option::FILE_EXTENSIONS, ['php', 'phpt']);\n\n    // configure cache paths \u0026 namespace - useful for Gitlab CI caching, where getcwd() produces always different path\n    // [default: sys_get_temp_dir() . '/_changed_files_detector_tests']\n    $parameters-\u003eset(Option::CACHE_DIRECTORY, '.ecs_cache');\n\n    // [default: \\Nette\\Utils\\Strings::webalize(getcwd())']\n    $parameters-\u003eset(Option::CACHE_NAMESPACE, 'my_project_namespace');\n\n    // indent and tabs/spaces\n    // [default: spaces]\n    $parameters-\u003eset(Option::INDENTATION, 'tab');\n\n    // [default: PHP_EOL]; other options: \"\\n\"\n    $parameters-\u003eset(Option::LINE_ENDING, \"\\r\\n\");\n};\n```\n\n## Codings Standards in Markdown\n\n![ECS-Run](docs/check_markdown.gif)\n\nHow to correct PHP snippets in Markdown files?\n\n```bash\nvendor/bin/ecs check-markdown README.md\nvendor/bin/ecs check-markdown README.md docs/rules.md\n\n# to fix them, add --fix\nvendor/bin/ecs check-markdown README.md docs/rules.md --fix\n```\n\nDo you have already paths defined in `ecs.php` config? Drop them from CLI and let ECS use those:\n\n```bash\nvendor/bin/ecs check-markdown --fix\n```\n\n## FAQ\n\n### How can I see all loaded checkers?\n\n```bash\nvendor/bin/ecs show\nvendor/bin/ecs show --config ...\n```\n\n### How do I clear cache?\n\n```bash\nvendor/bin/ecs check src --clear-cache\n```\n\n### Run on Git Diff Changed Files Only\n\nExecution can be limited to changed files using the `process` option `--match-git-diff`:\n\n```bash\nvendor/bin/ecs check src --match-git-diff\n```\n\nThis option will filter the files included by the configuration, creating an intersection with the files listed in `git diff`.\n\n## Your IDE Integration\n\n### PHPStorm\n\nECS can be used as an External Tool\n\n![PHPStorm Configuration](docs/phpstorm-config.png)\n\nGo to `Preferences` \u003e `Tools` \u003e `External Tools` and click `+` to add a new tool.\n\n- Name: `ecs` (Can be any value)\n- Description: `easyCodingStandard` (Can be any value)\n- Program: `$ProjectFileDir$/vendor/bin/ecs` (Path to `ecs` executable; On Windows path separators must be a `\\`)\n- Parameters: `check $FilePathRelativeToProjectRoot$` (append `--fix` to auto-fix)\n- Working directory: `$ProjectFileDir$`\n\nPress `Cmd/Ctrl` + `Shift` + `A` (Find Action), search for `ecs`, and then hit Enter. It will run `ecs` for the current file.\n\nTo run `ecs` on a directory, right click on a folder in the project browser go to external tools and select `ecs`.\n\nYou can also create a keyboard shortcut in [Preferences \u003e Keymap](https://www.jetbrains.com/help/webstorm/configuring-keyboard-and-mouse-shortcuts.html) to run `ecs`.\n\n### Visual Studio Code\n\n[EasyCodingStandard for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=azdanov.vscode-easy-coding-standard) extension adds support for running EasyCodingStandard inside the editor.\n\n## Tool Integration\n| Tool | Extension | Description |\n| ---- | --------- | ----------- |\n| [GrumPHP](https://github.com/phpro/grumphp) | [ECS Task](https://github.com/phpro/grumphp/blob/master/doc/tasks/ecs.md) | Provides a new task for GrumPHP which runs ECS |\n\n\u003cbr\u003e\n\n## Report Issues\n\nIn case you are experiencing a bug or want to request a new feature head over to the [Symplify monorepo issue tracker](https://github.com/symplify/symplify/issues)\n\n## Contribute\n\nThe sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on [symplify/symplify](https://github.com/symplify/symplify).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Feasy-coding-standard-prefixed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeprecated-packages%2Feasy-coding-standard-prefixed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Feasy-coding-standard-prefixed/lists"}