PHPackages                             typo3/coding-standards - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. typo3/coding-standards

ActiveCoding-standards[Utility &amp; Helpers](/categories/utility)

typo3/coding-standards
======================

A set of coding guidelines for any TYPO3-related project or extension

v0.8.0(1y ago)662.8M↑17.6%15[2 issues](https://github.com/TYPO3/coding-standards/issues)[2 PRs](https://github.com/TYPO3/coding-standards/pulls)20MITPHPPHP ^8.1CI failing

Since Nov 23Pushed 8mo ago3 watchersCompare

[ Source](https://github.com/TYPO3/coding-standards)[ Packagist](https://packagist.org/packages/typo3/coding-standards)[ Docs](https://typo3.org/)[ RSS](/packages/typo3-coding-standards/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (19)Used By (20)

TYPO3 Coding Standards Package
==============================

[](#typo3-coding-standards-package)

[![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)[![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)[![Coverage Status](https://camo.githubusercontent.com/0e482fb34002ae6ecbfa1d7f530bfa94f0839cd1259d88ec89949e2747b13049/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f5459504f332f636f64696e672d7374616e64617264732f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/TYPO3/coding-standards?branch=main)

You know the feeling: You work on your own extension, and then contribute to TYPO3, and TYPO3 delivers all the nice things to check for proper coding standards.

Well, same happens to all of us! Luckily, TYPO3 has this configuration in Core, and it's now available separately - ready to plug-and-play for you!

It does not matter if you're an extension developer, or a TYPO3 contributor, or working on your TYPO3 project.

Installation
------------

[](#installation)

Since this is a Composer package, run `composer require --dev typo3/coding-standards`in your Composer project, which of course includes TYPO3 project or extension or any other Composer project.

What's in the package?
----------------------

[](#whats-in-the-package)

The coding guidelines that are used in TYPO3 Core development. Instead of putting this information in our main repository, it should be helpful to apply certain rules to other projects as well. TYPO3 is more than just TYPO3 Core!

### PHP-CS-Fixer rules

[](#php-cs-fixer-rules)

Ensures that your PHP files are subject to the same rules.

### .editorconfig

[](#editorconfig)

If you work on a team, and you use different IDE settings, `.editorconfig`helps you to have the same settings across all editors. It does not matter if it is VS-Code, vim or PhpStorm, almost every editor supports the `.editorconfig`nowadays.

### Setting up the TYPO3 rule sets as boilerplate

[](#setting-up-the-typo3-rule-sets-as-boilerplate)

Our coding standards file can set this up for you. Run

```
composer exec typo3-coding-standards setup
```

or via the shortcut, which of course works for every command:

```
composer exec t3-cs s
```

The type `project` or `extension` is automatically detected. If the detection does not work for you (please also tell us about your case at ), you can specify the desired type as parameter like this:

```
composer exec typo3-coding-standards setup project
```

or

```
composer exec typo3-coding-standards setup extension
```

Have a look at the newly created files in your root folder:

- .php-cs-fixer.dist.php
- .editorconfig

For projects, the folder `src` is configured by default, but you can accommodate where your extensions or PHP code resides in. For extensions, PHP-CS-Fixer scans the whole base directory.

In addition, you can configure your PHP-CS-Fixer cache file folder and other configurations just like with PHP-CS-Fixer.

You can decide to commit them to your Git repository, which is the recommended way.

### Updating the TYPO3 rule sets

[](#updating-the-typo3-rule-sets)

To update the rule sets, run `composer update typo3/coding-standards`. An updated PHP-CS-Fixer rule set is applied immediately, but changes to the `.editorconfig`file must be applied manually by running `composer exec typo3-coding-standards update`.

This will overwrite your changes in the `.editorconfig` and reset it to the TYPO3 default values. Please make sure that your file has been properly committed to your repository before proceeding with the update.

You can also reset all files to the TYPO3 defaults by providing the `--force`option to the `setup` command:

```
composer exec -- typo3-coding-standards setup --force
```

Don't forget to provide the two dashes after `exec` if you use options.

### Advanced usage examples

[](#advanced-usage-examples)

Show a command specific help e.g. with `composer exec typo3-coding-standards help setup`.

It is possible to specify a destination folder for the files or to set up only a part of the TYPO3 coding standards, here are some examples.

Setup `.editorconfig` only:

```
composer exec -- typo3-coding-standards setup --rule-set=editorconfig
```

Setup `.php-cs-fixer.dist.php` in the `Build` folder:

```
composer exec -- typo3-coding-standards setup --target-dir=Build --rule-set=php-cs-fixer
```

Symfony comes with a great shortcut support for all commands e.g. this is the same like the last command above:

```
composer exec -- t3-cs s -d=Build -r=php-cs-fixer
```

Update the `.editorconfig`:

```
composer exec t3-cs u
```

Running the script directly not using Composer:

```
vendor/bin/typo3-coding-standards setup
```

Of course this assumes the binaries are installed by Composer at the default location `vendor/bin`. That's why we recommend using `composer exec` in the first place becaue Composer is aware of the correct location.

Executing the PHP-CS-Fixer
--------------------------

[](#executing-the-php-cs-fixer)

Once you've followed the step above, running PHP CS Fixer works like this:

```
composer exec php-cs-fixer
```

Have a look at our GitHub Actions [Continuous Integration workflow](https://github.com/TYPO3/coding-standards/blob/main/.github/workflows/continuous-integration.yml)to get an idea on how to automate your testing workflows using this package.

What's next?
------------

[](#whats-next)

We'd love to ship out license headers for all PHP files, however there are certain limitations (namespace must be underneath the license headers), which why this option is not enabled by default.

A note about our standards
--------------------------

[](#a-note-about-our-standards)

### PHP Coding Guidelines

[](#php-coding-guidelines)

TYPO3's coding guidelines have evolved over time. And we are happy to have PHP-FIG and PSR-1/PSR-2 and PSR-12. That's why we're committed to following these guidelines.

However, there are some more rules that we think are good:

- Remove leading slashes in use clauses.
- PHP single-line arrays should not have trailing comma.
- Single-line whitespace before closing semicolon are prohibited.
- Remove unused use statements in the PHP source code
- Ensure Concatenation to have at least one whitespace around
- Remove trailing whitespace at the end of blank lines.

Video Tutorial
--------------

[](#video-tutorial)

[![TYPO3-Tutorial - The TYPO3 Coding Standards Package](/Documentation/Files/youtube-video-tutorial.png)](https://youtu.be/P9fafF2IVpY)

Maintaining and Development of this package
-------------------------------------------

[](#maintaining-and-development-of-this-package)

This package is not meant to be updated regularly, since talking about coding guidelines takes a lot of time, and is usual a matter of taste. Nonetheless, you can always open up an issue if you feel like we're missing out on something.

A GitHub action automatically synchronizes the files with the TYPO3 Core. Please do not open pull requests for these changes, but push your changes to the TYPO3 Core.

### Development

[](#development)

The source code comes with a DDEV Local configuration that makes using Composer and switching PHP versions very easy. For more information about DDEV, see the [documentation](https://ddev.readthedocs.io).

In the `composer.json` many scripts are predefined to run the CI locally before you push erroneous changes. Additionally some fix commands are integrated.

#### Manually update the files from the core

[](#manually-update-the-files-from-the-core)

The synchronization job is scheduled once per night. It can also be started manually on the `Actions` tab on GitHub by selecting `Core Synchronization` and running the workflow on the main branch.

License &amp; Thanks
--------------------

[](#license--thanks)

This package is available under the MIT license, since it relies heavily on the PHP-CS-Fixer code.

In addition, I would like to thank the TYPO3 Core Team that kickstarted this set of rules in 2015, and to the creators and maintainers of PHP-CS-Fixer package.

Benni Mack, TYPO3 Project Lead

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance47

Moderate activity, may be stable

Popularity56

Moderate usage in the ecosystem

Community45

Growing community involvement

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 50.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~97 days

Recently: every ~132 days

Total

18

Last Release

714d ago

PHP version history (4 changes)v0.1.0PHP ^7.2

v0.3.0PHP ^7.2 || ^8.0

v0.7.0PHP ^8.0

v0.8.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/88698?v=4)[TYPO3 GitHub Department](/maintainers/typo3)[@TYPO3](https://github.com/TYPO3)

![](https://avatars.githubusercontent.com/u/165630?v=4)[Benni Mack](/maintainers/bmack)[@bmack](https://github.com/bmack)

![](https://avatars.githubusercontent.com/u/402145?v=4)[Oliver Hader](/maintainers/ohader)[@ohader](https://github.com/ohader)

---

Top Contributors

[![gilbertsoft](https://avatars.githubusercontent.com/u/25326036?v=4)](https://github.com/gilbertsoft "gilbertsoft (79 commits)")[![bmack](https://avatars.githubusercontent.com/u/165630?v=4)](https://github.com/bmack "bmack (43 commits)")[![eliashaeussler](https://avatars.githubusercontent.com/u/16313625?v=4)](https://github.com/eliashaeussler "eliashaeussler (11 commits)")[![oliverklee](https://avatars.githubusercontent.com/u/765746?v=4)](https://github.com/oliverklee "oliverklee (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![mbrodala](https://avatars.githubusercontent.com/u/5037116?v=4)](https://github.com/mbrodala "mbrodala (3 commits)")[![ochorocho](https://avatars.githubusercontent.com/u/4623070?v=4)](https://github.com/ochorocho "ochorocho (3 commits)")[![simonschaufi](https://avatars.githubusercontent.com/u/941794?v=4)](https://github.com/simonschaufi "simonschaufi (1 commits)")[![brotkrueml](https://avatars.githubusercontent.com/u/2566282?v=4)](https://github.com/brotkrueml "brotkrueml (1 commits)")[![lolli42](https://avatars.githubusercontent.com/u/2178068?v=4)](https://github.com/lolli42 "lolli42 (1 commits)")[![marble](https://avatars.githubusercontent.com/u/307057?v=4)](https://github.com/marble "marble (1 commits)")[![ohader](https://avatars.githubusercontent.com/u/402145?v=4)](https://github.com/ohader "ohader (1 commits)")

---

Tags

Code stylecmstypo3php-cs-fixereditorconfig

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/typo3-coding-standards/health.svg)

```
[![Health](https://phpackages.com/badges/typo3-coding-standards/health.svg)](https://phpackages.com/packages/typo3-coding-standards)
```

###  Alternatives

[jubeki/laravel-code-style

Combine Custom Fixers with the ruleset of Laravel Pint to fix your code style in Laravel Applications/Packages.

56521.7k8](/packages/jubeki-laravel-code-style)[typo3/cms-composer-installers

TYPO3 CMS Installers

6113.7M52](/packages/typo3-cms-composer-installers)[koninklijke-collective/my-redirects

TYPO3 Extension: Redirects management

17152.4k](/packages/koninklijke-collective-my-redirects)[codingfreaks/cf-cookiemanager

Manage cookies, scripts, and GDPR compliance on your Typo3 website with CodingFreaks Typo3 Cookie Manager. Customize cookie banners, streamline workflow, and enhance user experience. Ensure GDPR compliance and take control of cookie management with our Typo3 cookie management extension. Visit the official Typo3 Documentation page to learn more.

1625.8k](/packages/codingfreaks-cf-cookiemanager)[t3kit/theme-t3kit

Base Theme fot t3kit project

2410.2k](/packages/t3kit-theme-t3kit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
