{"id":13410806,"url":"https://github.com/yiisoft/yii2-coding-standards","last_synced_at":"2025-05-16T14:08:47.835Z","repository":{"id":52182081,"uuid":"10550782","full_name":"yiisoft/yii2-coding-standards","owner":"yiisoft","description":"Yii 2 coding standards","archived":false,"fork":false,"pushed_at":"2024-07-07T14:52:14.000Z","size":32,"stargazers_count":179,"open_issues_count":1,"forks_count":49,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-05-01T22:38:39.672Z","etag":null,"topics":["codesniffer","coding-standards","hacktoberfest","yii2"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"open_collective":"yiisoft"}},"created_at":"2013-06-07T13:50:36.000Z","updated_at":"2025-04-08T01:39:47.000Z","dependencies_parsed_at":"2023-11-09T15:05:14.192Z","dependency_job_id":"38916209-83c4-41d7-babc-c078a1acca47","html_url":"https://github.com/yiisoft/yii2-coding-standards","commit_stats":{"total_commits":33,"total_committers":17,"mean_commits":"1.9411764705882353","dds":0.8181818181818181,"last_synced_commit":"842ffdf6c31f46bb6f4b3f3c7dda4f570321ace7"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-coding-standards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-coding-standards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-coding-standards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-coding-standards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/yii2-coding-standards/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253199481,"owners_count":21870082,"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":["codesniffer","coding-standards","hacktoberfest","yii2"],"created_at":"2024-07-30T20:01:09.407Z","updated_at":"2025-05-16T14:08:47.809Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","readme":"Yii 2 Web Framework Coding Standard\n===================================\n\nThis repository contains settings for [Yii2 coding style](https://github.com/yiisoft/yii2/wiki/Core-framework-code-style)\nfor various tools.\n\nGetting code\n------------\n\nYou can get code style definition using one of the following methods.\n\n* Clone `yiisoft/yii2-coding-standards` repository:\n\n```\n$ git clone git://github.com/yiisoft/yii2-coding-standards.git\n```\n\n* Install `composer.phar` distribution:\n\n```\n$ curl -sS https://getcomposer.org/installer | php\n```\n\nOr if your system doesn't have CURL installed:\n\n```\n$ php -r \"eval('?\u003e'.file_get_contents('https://getcomposer.org/installer'));\"\n```\n\n* Set up all dependencies declared in `composer.json`:\n\n```\n$ php composer.phar install\n```\n\nPHP_Codesniffer\n---------------\n\n[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) coding standard, rule set\nand sniff token parsing classes for the [Yii 2 Web Framework](https://github.com/yiisoft/yii2/). Overally rules\nare based on PSR-12 standard with some minor exceptions and changes. Rules derived from PSR-12 standard and excluded\nin Yii2 standard were implemented (or planned to be) as sniff classes.\n\nRules could also be used for checking code style of an existing Yii2 applications.\n\nEverything that is merged into main [Yii2 development repository](https://github.com/yiisoft/yii2) being checked\nwith these rule set as well.\n\n### Using code style\n\nAfter CodeSniffer is installed you can launch it with custom code style using the following syntax:\n\n```\n$ ./vendor/bin/phpcs --extensions=php --standard=Yii2 /home/resurtm/work/Yii2MegaApp/\n```\n\nInstallation can be also be done automatically with this tool:\n\n```bash\ncomposer require --dev dealerdirect/phpcodesniffer-composer-installer\n```\n\nWhen using Composer 2.2 or higher, Composer will [ask for your permission](https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution) to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted.\n\nWhen permission has been granted, the following snippet will automatically be added to your `composer.json` file by Composer:\n```json\n{\n    \"config\": {\n        \"allow-plugins\": {\n            \"dealerdirect/phpcodesniffer-composer-installer\": true\n        }\n    }\n}\n```\n\nWhen using Composer \u003c 2.2, you can add the permission flag ahead of the upgrade to Composer 2.2, by running:\n```bash\ncomposer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true\n```\n\nIf you're using PhpStorm you can configure it to use CodeSniffer using Settings → PHP → Code Sniffer.\nYii2 code style can be specified at Inspections → PHP → PHP Code Sniffer validation.\n\n### Useful links\n\n* [Configuration options](https://pear.php.net/manual/en/package.php.php-codesniffer.config-options.php)\n* [Manual and guide](https://github.com/squizlabs/PHP_CodeSniffer/wiki)\n* [GitHub repository](https://github.com/squizlabs/PHP_CodeSniffer)\n\nPhpStorm\n--------\n\nYii uses PSR-12 as code style standard. You can choose these via `Settings` → `Code Style` → `PHP` → `Set from...` → `Predefined Style` → `PSR12`.\n\nADDITIONAL NOTES\n----------------\n\nFeel free to request additional features, submit bugs and problems.\n\nThank you for choosing Yii Framework!\n","funding_links":["https://opencollective.com/yiisoft"],"categories":["PHP","Docs 文档"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fyii2-coding-standards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Fyii2-coding-standards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fyii2-coding-standards/lists"}