PHPackages                             code050/codestyle - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. code050/codestyle

ActiveLibrary[Testing &amp; Quality](/categories/testing)

code050/codestyle
=================

The official Code050 codestyle package, containing a guideline, a phpcs configuration and a phpstan configuration.

2.0.5(3y ago)12.7k[1 issues](https://github.com/code050/codestyle/issues)[1 PRs](https://github.com/code050/codestyle/pulls)1MITPHPPHP &gt;7.4

Since Feb 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/code050/codestyle)[ Packagist](https://packagist.org/packages/code050/codestyle)[ RSS](/packages/code050-codestyle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (16)Used By (1)

[![banner](https://camo.githubusercontent.com/66fc1071436ed0560e4fb250c7875c85155fe386e79ee645fc850c1baa83918c/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f436f64657374796c652e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d636f6465303530253246636f64657374796c65267061747465726e3d636f6e6e656374696f6e73267374796c653d7374796c655f31266465736372697074696f6e3d5468652b6f6666696369616c2b436f64653035302b636f64657374796c652b7061636b616765266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)](https://camo.githubusercontent.com/66fc1071436ed0560e4fb250c7875c85155fe386e79ee645fc850c1baa83918c/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f436f64657374796c652e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d636f6465303530253246636f64657374796c65267061747465726e3d636f6e6e656374696f6e73267374796c653d7374796c655f31266465736372697074696f6e3d5468652b6f6666696369616c2b436f64653035302b636f64657374796c652b7061636b616765266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)

Code050 Codestyle
=================

[](#code050-codestyle)

The official Code050 codestyle package.

Guidelines
----------

[](#guidelines)

A description of the guidelines can be found in the [Code050 Codestyle Guidelines](guideline.md) document.

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

[](#installation)

You can install the package via composer:

```
composer require code050/codestyle
```

Usage
-----

[](#usage)

The primary usage of the package is to provide a consistent code style for all Code050 projects. We achieve this by using a combination of various tools. Currently, these tools include:

- PHPStan
- PHP\_CodeSniffer

The package contains stub configurations for these tools which can be used in your project.

### Initializing the package

[](#initializing-the-package)

To initialize the package, you can run the following command:

```
composer code050:codestyle:init
```

This will copy the stub configuration files to your project, but will not overwrite any existing files. If you want to overwrite existing files, you can use the `-- --overwrite` flag. Note the double `--` before the `--overwrite` flag.

When initializing the package in an existing project, chances are that you will get loads of errors from the PHP\_CodeSniffer and PHPStan checks. This is because the stub configuration files are very strict and will enforce a lot of rules. For PHPStan you can generate a baseline file to ignore all the errors.

If you do not want to use the Php-cs baseline for your project, you can use `--loose` flag to initialize the package with a looser configuration. This will report a lot of common errors as warnings instead of errors, so you can fix them at your own pace. In the background the `--loose` flag will copy the `phpcs.loose.xml` file instead of the `phpcs.xml` file. You can even extend this file with more custom rule mitigations, to get to the 0 error state.

### Running the checks

[](#running-the-checks)

To ensure your code follows the Code050 codestyle, you need to run the PHP\_CodeSniffer and PHPStan checks. You can run the PHP\_CodeSniffer checks by running the following command:

#### PHP\_CodeSniffer

[](#php_codesniffer)

```
composer code050:codestyle:check
```

This command will check your code against the Code050 codestyle rules and provide feedback on any issues found.

To automatically fix any issues found by PHP\_CodeSniffer, you can run the following command:

```
composer code050:codestyle:fix
```

#### PHPstan

[](#phpstan)

You can run the PHPStan checks by running the following command:

```
composer code050:codestyle:stan
```

This command will check your code against the Code050 PHPStan rules and provide feedback on any issues found.

Configuration
-------------

[](#configuration)

### PHP\_CodeSniffer

[](#php_codesniffer-1)

After initializing the package, you can configure the PHP\_CodeSniffer rules by editing the `phpcs.xml` file in the root of your project. You can find more information about the rules that can be configured in the [PHP\_CodeSniffer documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki).

Basically, when you want to ignore certain rules, you can add the following to the `phpcs.xml` file:

```

```

#### Example: configuring cognitive complexity

[](#example-configuring-cognitive-complexity)

```

```

When you want to ignore a rule only in a certain path, you can add the following to the `phpcs.xml` file:

```

        */tests/*

```

### PHPStan

[](#phpstan-1)

You can change the PHPStan configuration by editing the `phpstan.neon` file in the root of your project. You can find more information about the rules that can be configured in the [PHPStan documentation](https://phpstan.org/user-guide/getting-started).

#### Generating baseline

[](#generating-baseline)

When you want to generate a baseline file, you can run the following command:

```
composer code050:codestyle:stan:baseline
```

This will generate a `phpstan-baseline.neon` file in the root of your project. It will also register this baseline in your `phpstan.neon` file, so it will be used when running the PHPStan checks.

General notes
-------------

[](#general-notes)

If you encounter any issues with the package, please create an issue on the [GitHub repository](https://github.com/code050/codestyle/issues).

Workflow for legacy projects
----------------------------

[](#workflow-for-legacy-projects)

Unfortunately, we can't just run the init and fixer commands on legacy projects. This will probably break some things, but more often than not, after generation of a phpstan baseline, the project will still have PHPStan errors.

These errors usually indicate serious problems in the code, that would probably throw exceptions when hit in production. So, we need to fix these errors manually.

For PHP\_CodeSniffer, we can use the `--loose` flag to generate a looser configuration. This will report a lot of common errors as warnings instead of errors, so you can fix them at your own pace. You can find a detailed explanation of the `--loose` flag in the [Initialization](#initializing-the-package) section.

So firstly we need to run the init command with the `--loose` flag:

```
composer code050:codestyle:init -- --loose
```

After this, we can run the PHP\_CodeSniffer fixer command:

```
composer code050:codestyle:fix
```

Then we run PHPStan to generate a baseline file:

```
composer code050:codestyle:stan:baseline
```

The errors that remain after this, are the ones that need to be fixed manually. For PHP\_CodeSniffer, you can report these errors as warnings as described in the [Initialization](#initializing-the-package) section. For PHPStan, you should fix the error manually.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~10 days

Recently: every ~15 days

Total

10

Last Release

1104d ago

Major Versions

1.0.5 → 2.02023-03-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb78fcc4960bbdebb8948afb6a2c594ec69357f0f182a82b21d16d7e6b44fbed?d=identicon)[Code050](/maintainers/Code050)

---

Top Contributors

[![MelchiorKokernoot](https://avatars.githubusercontent.com/u/23347384?v=4)](https://github.com/MelchiorKokernoot "MelchiorKokernoot (45 commits)")

### Embed Badge

![Health badge](/badges/code050-codestyle/health.svg)

```
[![Health](https://phpackages.com/badges/code050-codestyle/health.svg)](https://phpackages.com/packages/code050-codestyle)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

66766.6M1.1k](/packages/phpstan-phpstan-doctrine)[wp-cli/wp-cli-tests

WP-CLI testing framework

422.7M87](/packages/wp-cli-wp-cli-tests)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13176.9k8](/packages/youwe-testing-suite)[calebdw/larastan-livewire

A Larastan / PHPStan extension for Livewire.

43482.4k3](/packages/calebdw-larastan-livewire)

PHPackages © 2026

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