PHPackages                             ctw/ctw-qa - 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. ctw/ctw-qa

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

ctw/ctw-qa
==========

Configuration for commonly used quality assurance (QA) tools for PHP projects.

5.0.15(1w ago)02.5k↑36.9%16proprietaryPHPPHP ^8.3CI passing

Since Jun 11Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/jonathanmaron/ctw-qa)[ Packagist](https://packagist.org/packages/ctw/ctw-qa)[ RSS](/packages/ctw-ctw-qa/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (24)Versions (55)Used By (16)

Package "ctw/ctw-qa"
====================

[](#package-ctwctw-qa)

[![Latest Stable Version](https://camo.githubusercontent.com/4115af159ac356195e45fc6d3a08f8c32d24e54f0a789a9e3b2168801e80f072/68747470733a2f2f706f7365722e707567782e6f72672f6374772f6374772d71612f762f737461626c65)](https://packagist.org/packages/ctw/ctw-qa)[![GitHub Actions](https://github.com/jonathanmaron/ctw-qa/actions/workflows/tests.yml/badge.svg)](https://github.com/jonathanmaron/ctw-qa/actions/workflows/tests.yml)[![Scrutinizer Build](https://camo.githubusercontent.com/7b345b00a93d37f8f93929f0ea4a97bf2474a4815c2a6bb1f3481d0046f3d29f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f6e617468616e6d61726f6e2f6374772d71612f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jonathanmaron/ctw-qa/build-status/master)[![Scrutinizer Quality](https://camo.githubusercontent.com/3dcbf2614ade35acbe97b16a427428e9a438dd3ce5f200d16c640ae8331bb909/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f6e617468616e6d61726f6e2f6374772d71612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jonathanmaron/ctw-qa/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/52f1de2883369c0314f2867dfe6e408065d6aee5981beffedf876b23bd5ea25c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f6e617468616e6d61726f6e2f6374772d71612f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jonathanmaron/ctw-qa/?branch=master)

Centralized, opinionated configuration for PHP 8.3+ quality assurance tools: Rector, Easy Coding Standard (ECS), and PHPStan.

Introduction
------------

[](#introduction)

### Why This Library Exists

[](#why-this-library-exists)

Setting up quality assurance tools properly is tedious and error-prone. Each project requires configuring:

- **Rector** for code modernization (100+ lines of configuration)
- **Easy Coding Standard** for style enforcement (150+ lines)
- **PHPStan** for static analysis (50+ lines)

Multiplied across numerous projects, this becomes a maintenance burden. Configurations drift, standards diverge, and teams waste time debugging tool setups instead of writing code.

This library provides:

- **Battle-tested defaults**: Years of PHP best practices encoded in reusable configuration classes
- **PHP 8.3+ standards**: Modern PHP syntax, strict types, and property promotion
- **PSR-12 compliance**: Full adherence to PHP coding standards
- **Extensible architecture**: Override any default via class inheritance
- **Consistent tooling**: Identical QA configuration across all projects

### Problems This Library Solves

[](#problems-this-library-solves)

1. **Configuration drift**: Projects diverge in coding standards over time
2. **Repetitive setup**: Same boilerplate written for every new project
3. **Inconsistent quality**: Different strictness levels across codebases
4. **Maintenance burden**: Tool updates require changes in multiple places
5. **Onboarding friction**: New developers must learn project-specific configurations

### Where to Use This Library

[](#where-to-use-this-library)

- **New PHP projects**: Start with modern, strict standards from day one
- **Existing codebases**: Gradually modernize legacy code with Rector
- **Monorepos**: Share identical QA configuration across all packages
- **CI/CD pipelines**: Automated quality gates with consistent rules
- **Open source libraries**: Enforce professional-grade code quality

### Design Goals

[](#design-goals)

1. **Opinionated defaults**: Strong opinions for modern PHP, easily overridable
2. **Invokable classes**: Simple `$config()` syntax for integration
3. **Maximum strictness**: PHPStan level `max`, strict comparisons, strict types
4. **Minimal dependencies**: Only the three QA tools themselves
5. **Extensible**: All configuration classes designed for inheritance

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- Composer

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

[](#installation)

Install by adding the package as a [Composer](https://getcomposer.org) requirement:

```
composer require ctw/ctw-qa --dev
```

Usage Examples
--------------

[](#usage-examples)

### Rector Configuration

[](#rector-configuration)

Create `rector.php` in your project root:

```
