{"id":14987273,"url":"https://github.com/codeigniter/coding-standard","last_synced_at":"2025-05-16T14:07:43.199Z","repository":{"id":46313485,"uuid":"397783642","full_name":"CodeIgniter/coding-standard","owner":"CodeIgniter","description":"Official Coding Standards for CodeIgniter","archived":false,"fork":false,"pushed_at":"2025-05-02T16:51:48.000Z","size":173,"stargazers_count":69,"open_issues_count":0,"forks_count":10,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2025-05-16T14:07:40.620Z","etag":null,"topics":["codeigniter","coding-standards"],"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/CodeIgniter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2021-08-19T01:45:58.000Z","updated_at":"2025-05-02T16:50:05.000Z","dependencies_parsed_at":"2024-05-05T16:49:16.158Z","dependency_job_id":"cecd6641-bc8c-4363-b03c-e8fdf5e375fb","html_url":"https://github.com/CodeIgniter/coding-standard","commit_stats":{"total_commits":135,"total_committers":6,"mean_commits":22.5,"dds":0.0888888888888889,"last_synced_commit":"2c16682b4a3754bc6694fef1056f686f32298ee3"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIgniter%2Fcoding-standard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIgniter%2Fcoding-standard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIgniter%2Fcoding-standard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIgniter%2Fcoding-standard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeIgniter","download_url":"https://codeload.github.com/CodeIgniter/coding-standard/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"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":["codeigniter","coding-standards"],"created_at":"2024-09-24T14:14:21.806Z","updated_at":"2025-05-16T14:07:43.138Z","avatar_url":"https://github.com/CodeIgniter.png","language":"PHP","readme":"# CodeIgniter Coding Standard\n\n[![Unit Tests](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpunit.yml/badge.svg)](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpunit.yml)\n[![Coding Standards](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-coding-standards.yml/badge.svg)](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-coding-standards.yml)\n[![PHPStan Static Analysis](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpstan.yml/badge.svg)](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpstan.yml)\n[![PHPStan level](https://img.shields.io/badge/PHPStan-max%20level-brightgreen)](phpstan.neon.dist)\n[![Coverage Status](https://coveralls.io/repos/github/CodeIgniter/coding-standard/badge.svg?branch=develop)](https://coveralls.io/github/CodeIgniter/coding-standard?branch=develop)\n[![Latest Stable Version](http://poser.pugx.org/codeigniter/coding-standard/v)](//packagist.org/packages/codeigniter/coding-standard)\n[![License](https://img.shields.io/github/license/codeigniter/coding-standard)](LICENSE)\n[![Total Downloads](http://poser.pugx.org/codeigniter/coding-standard/downloads)](//packagist.org/packages/codeigniter/coding-standard)\n\nThis library holds the official coding standards of CodeIgniter based\non [PHP CS Fixer][1] and powered by [Nexus CS Config][2].\n\n## Installation\n\nYou can add this library as a local, per-project dependency to your project\nusing [Composer](https://getcomposer.org/):\n\n    composer require codeigniter/coding-standard\n\nIf you only need this library during development, for instance to run your project's test suite,\nthen you should add it as a development-time dependency:\n\n    composer require --dev codeigniter/coding-standard\n\n## Setup\n\nTo start, let us create a `.php-cs-fixer.dist.php` file at the root of your project.\n\n```php\n\u003c?php\n\nuse CodeIgniter\\CodingStandard\\CodeIgniter4;\nuse Nexus\\CsConfig\\Factory;\n\nreturn Factory::create(new CodeIgniter4())-\u003eforProjects();\n\n```\n\nThis minimal setup will return a default instance of `PhpCsFixer\\Config` containing all rules applicable\nfor the CodeIgniter organization.\n\nThen, in your terminal, run the following command:\n\n```console\n$ vendor/bin/php-cs-fixer fix --verbose\n```\n\n## Adding License Headers\n\nThe default setup will not configure a license header in files. License headers can be especially useful\nfor library authors to assert copyright. To add license headers in your PHP files, you can simply provide\nyour name and name of library. Optionally, you can also provide your email and starting license year.\n\n```diff\n \u003c?php\n\n use CodeIgniter\\CodingStandard\\CodeIgniter4;\n use Nexus\\CsConfig\\Factory;\n\n-return Factory::create(new CodeIgniter4())-\u003eforProjects();\n+return Factory::create(new CodeIgniter4())-\u003eforLibrary(\n+    'CodeIgniter 4 framework',\n+    'CodeIgniter Foundation',\n+    'admin@codeigniter.com',\n+    2021,\n+);\n\n```\n\n## Providing Overriding Rules and Options\n\nThe list of enabled rules can be found in the [`CodeIgniter\\CodingStandard\\CodeIgniter4`][3] class. If you\nfeel the rule is not applicable to you or you want to modify it, you can do so by providing an array of\noverriding rules to the second parameter of `Factory::create()`.\n\nSimilarly, you can further modify the `PhpCsFixer\\Config` instance returned by using the available options.\nAll available options are fully supported by [Nexus CS Config][2] and abstracted by simply providing an\narray of key-value pairs in the third parameter of `Factory::create()`.\n\n```diff\n \u003c?php\n\n use CodeIgniter\\CodingStandard\\CodeIgniter4;\n use Nexus\\CsConfig\\Factory;\n\n-return Factory::create(new CodeIgniter4())-\u003eforProjects();\n+return Factory::create(new CodeIgniter4(), [], [\n+    'usingCache' =\u003e false,\n+])-\u003eforProjects();\n\n```\n\nYou can check out this library's own [`.php-cs-fixer.dist.php`][4] for inspiration on how it is done.\nFor more detailed documentation on all available options, you can check [here][2].\n\n## Contributing\n\nAll forms of contributions are welcome!\n\nSince the rules here will be propagated and used within the CodeIgniter organization, all proposed rules\nand modifications to existing rules should have a proof-of-concept (POC) PR sent first to\nthe [CodeIgniter4][5] repository with possible changes to the code styles applied there. Once accepted\nthere, you can send in a PR here to apply those rules.\n\n## License\n\nThis work is open-sourced under the MIT license.\n\n[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer\n[2]: https://github.com/NexusPHP/cs-config\n[3]: src/CodeIgniter4.php\n[4]: .php-cs-fixer.dist.php\n[5]: https://github.com/codeigniter4/CodeIgniter4\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeigniter%2Fcoding-standard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeigniter%2Fcoding-standard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeigniter%2Fcoding-standard/lists"}