{"id":19109254,"url":"https://github.com/typo3/coding-standards","last_synced_at":"2025-05-16T15:07:53.097Z","repository":{"id":40621041,"uuid":"223493570","full_name":"TYPO3/coding-standards","owner":"TYPO3","description":"TYPO3 Coding Standards to be used by TYPO3 projects or extensions","archived":false,"fork":false,"pushed_at":"2025-05-06T09:23:20.000Z","size":508,"stargazers_count":59,"open_issues_count":3,"forks_count":16,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-16T15:07:43.317Z","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/TYPO3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-11-22T22:00:06.000Z","updated_at":"2025-05-06T09:23:24.000Z","dependencies_parsed_at":"2024-01-30T21:44:15.684Z","dependency_job_id":"f1841a72-2ab6-4ffe-b1fd-e484e0557232","html_url":"https://github.com/TYPO3/coding-standards","commit_stats":{"total_commits":78,"total_committers":10,"mean_commits":7.8,"dds":"0.17948717948717952","last_synced_commit":"cc5bbfec0e904941e67b12e777b76184d6b84a48"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYPO3%2Fcoding-standards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYPO3%2Fcoding-standards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYPO3%2Fcoding-standards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYPO3%2Fcoding-standards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TYPO3","download_url":"https://codeload.github.com/TYPO3/coding-standards/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"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":[],"created_at":"2024-11-09T04:19:41.848Z","updated_at":"2025-05-16T15:07:48.088Z","avatar_url":"https://github.com/TYPO3.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TYPO3 Coding Standards Package\n\n[![Continuous Integration (CI)](https://github.com/TYPO3/coding-standards/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/TYPO3/coding-standards/actions/workflows/continuous-integration.yml)\n[![Core Synchronization](https://github.com/TYPO3/coding-standards/actions/workflows/core-synchronization.yml/badge.svg)](https://github.com/TYPO3/coding-standards/actions/workflows/core-synchronization.yml)\n[![Coverage Status](https://coveralls.io/repos/github/TYPO3/coding-standards/badge.svg?branch=main)](https://coveralls.io/github/TYPO3/coding-standards?branch=main)\n\nYou know the feeling: You work on your own extension, and then contribute to\nTYPO3, and TYPO3 delivers all the nice things to check for proper coding\nstandards.\n\nWell, same happens to all of us! Luckily, TYPO3 has this configuration in Core,\nand it's now available separately - ready to plug-and-play for you!\n\nIt does not matter if you're an extension developer, or a TYPO3 contributor, or\nworking on your TYPO3 project.\n\n## Installation\n\nSince this is a Composer package, run `composer require --dev typo3/coding-standards`\nin your Composer project, which of course includes TYPO3 project or extension or\nany other Composer project.\n\n## What's in the package?\n\nThe coding guidelines that are used in TYPO3 Core development. Instead of\nputting this information in our main repository, it should be helpful to apply\ncertain rules to other projects as well. TYPO3 is more than just TYPO3 Core!\n\n### PHP-CS-Fixer rules\n\nEnsures that your PHP files are subject to the same rules.\n\n### .editorconfig\n\nIf you work on a team, and you use different IDE settings, `.editorconfig`\nhelps you to have the same settings across all editors. It does not matter if\nit is VS-Code, vim or PhpStorm, almost every editor supports the `.editorconfig`\nnowadays.\n\n### Setting up the TYPO3 rule sets as boilerplate\n\nOur coding standards file can set this up for you. Run\n\n```bash\ncomposer exec typo3-coding-standards setup\n```\n\nor via the shortcut, which of course works for every command:\n\n```bash\ncomposer exec t3-cs s\n```\n\nThe type `project` or `extension` is automatically detected. If the detection\ndoes not work for you (please also tell us about your case at\n\u003chttps://github.com/TYPO3/coding-standards/issues\u003e), you can specify the\ndesired type as parameter like this:\n\n```bash\ncomposer exec typo3-coding-standards setup project\n```\n\nor\n\n```bash\ncomposer exec typo3-coding-standards setup extension\n```\n\nHave a look at the newly created files in your root folder:\n\n* .php-cs-fixer.dist.php\n* .editorconfig\n\nFor projects, the folder `src` is configured by default, but you can\naccommodate where your extensions or PHP code resides in. For extensions,\nPHP-CS-Fixer scans the whole base directory.\n\nIn addition, you can configure your PHP-CS-Fixer cache file folder and other\nconfigurations just like with PHP-CS-Fixer.\n\nYou can decide to commit them to your Git repository, which is the recommended\nway.\n\n### Updating the TYPO3 rule sets\n\nTo update the rule sets, run `composer update typo3/coding-standards`. An updated\nPHP-CS-Fixer rule set is applied immediately, but changes to the `.editorconfig`\nfile must be applied manually by running `composer exec typo3-coding-standards update`.\n\nThis will overwrite your changes in the `.editorconfig` and reset it to the\nTYPO3 default values. Please make sure that your file has been properly\ncommitted to your repository before proceeding with the update.\n\nYou can also reset all files to the TYPO3 defaults by providing the `--force`\noption to the `setup` command:\n\n```bash\ncomposer exec -- typo3-coding-standards setup --force\n```\n\nDon't forget to provide the two dashes after `exec` if you use options.\n\n### Advanced usage examples\n\nShow a command specific help e.g. with `composer exec typo3-coding-standards help setup`.\n\nIt is possible to specify a destination folder for the files or to set up only\na part of the TYPO3 coding standards, here are some examples.\n\nSetup `.editorconfig` only:\n\n```bash\ncomposer exec -- typo3-coding-standards setup --rule-set=editorconfig\n```\n\nSetup `.php-cs-fixer.dist.php` in the `Build` folder:\n\n```bash\ncomposer exec -- typo3-coding-standards setup --target-dir=Build --rule-set=php-cs-fixer\n```\n\nSymfony comes with a great shortcut support for all commands e.g. this is the\nsame like the last command above:\n\n```bash\ncomposer exec -- t3-cs s -d=Build -r=php-cs-fixer\n```\n\nUpdate the `.editorconfig`:\n\n```bash\ncomposer exec t3-cs u\n```\n\nRunning the script directly not using Composer:\n\n```bash\nvendor/bin/typo3-coding-standards setup\n```\n\nOf course this assumes the binaries are installed by Composer at the default\nlocation `vendor/bin`. That's why we recommend using `composer exec` in the\nfirst place becaue Composer is aware of the correct location.\n\n## Executing the PHP-CS-Fixer\n\nOnce you've followed the step above, running PHP CS Fixer works like this:\n\n```bash\ncomposer exec php-cs-fixer\n```\n\nHave a look at our GitHub Actions [Continuous Integration workflow](https://github.com/TYPO3/coding-standards/blob/main/.github/workflows/continuous-integration.yml)\nto get an idea on how to automate your testing workflows using this package.\n\n## What's next?\n\nWe'd love to ship out license headers for all PHP files, however there are\ncertain limitations (namespace must be underneath the license headers), which\nwhy this option is not enabled by default.\n\n## A note about our standards\n\n### PHP Coding Guidelines\n\nTYPO3's coding guidelines have evolved over time. And we are happy to have\nPHP-FIG and PSR-1/PSR-2 and PSR-12. That's why we're committed to following\nthese guidelines.\n\nHowever, there are some more rules that we think are good:\n\n* Remove leading slashes in use clauses.\n* PHP single-line arrays should not have trailing comma.\n* Single-line whitespace before closing semicolon are prohibited.\n* Remove unused use statements in the PHP source code\n* Ensure Concatenation to have at least one whitespace around\n* Remove trailing whitespace at the end of blank lines.\n\n## Video Tutorial\n\n[![TYPO3-Tutorial - The TYPO3 Coding Standards Package](/Documentation/Files/youtube-video-tutorial.png)](https://youtu.be/P9fafF2IVpY)\n\n## Maintaining and Development of this package\n\nThis package is not meant to be updated regularly, since talking about coding\nguidelines takes a lot of time, and is usual a matter of taste. Nonetheless,\nyou can always open up an issue if you feel like we're missing out on something.\n\nA GitHub action automatically synchronizes the files with the TYPO3 Core. Please\ndo not open pull requests for these changes, but push your changes to the\nTYPO3 Core.\n\n### Development\n\nThe source code comes with a DDEV Local configuration that makes using Composer\nand switching PHP versions very easy. For more information about DDEV, see the\n[documentation](https://ddev.readthedocs.io).\n\nIn the `composer.json` many scripts are predefined to run the CI locally before\nyou push erroneous changes. Additionally some fix commands are integrated.\n\n#### Manually update the files from the core\n\nThe synchronization job is scheduled once per night. It can also be started\nmanually on the `Actions` tab on GitHub by selecting `Core Synchronization` and\nrunning the workflow on the main branch.\n\n## License \u0026 Thanks\n\nThis package is available under the MIT license, since it relies heavily on the\nPHP-CS-Fixer code.\n\nIn addition, I would like to thank the TYPO3 Core Team that kickstarted this\nset of rules in 2015, and to the creators and maintainers of PHP-CS-Fixer\npackage.\n\nBenni Mack, TYPO3 Project Lead\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypo3%2Fcoding-standards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypo3%2Fcoding-standards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypo3%2Fcoding-standards/lists"}