Download the PHP package ctw/ctw-qa without Composer

On this page you can find all versions of the php package ctw/ctw-qa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ctw-qa

Package "ctw/ctw-qa"

Latest Stable Version GitHub Actions

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

Introduction

Why This Library Exists

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

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:

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

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 four QA tools themselves
  5. Extensible: All configuration classes designed for inheritance

Requirements

Installation

Install by adding the package as a Composer requirement:

Usage Examples

Rector Configuration

Create rector.php in your project root:

ECS Configuration

Create ecs.php in your project root:

PHPStan Configuration

Create phpstan.neon in your project root:

Composer Dependency Analyser Configuration

Create composer-dependency-analyser.php in your project root:

The file returns a Configuration object rather than a closure, and needs no require of vendor/autoload.php to reach the Ctw\Qa classes: the analyser loads the vendor directory belonging to the composer.json it is analysing before it reads the configuration.

Composer Dependency Analyser answers four questions rather than one. Beyond the declared dependency nothing uses, it reports the shadow dependency — a class used from a package your composer.json never declared, which arrives only because something else happens to require it — and the dependency declared in the wrong section of composer.json, either way round. It resolves a symbol back to the package that autoloads it, which leaves two ways to handle a dependency no scan can see: prove it where a file can, exclude the error where none can.

Prove it, by scanning the file that references it. The analyser scans the autoload paths from your composer.json, which leaves the project root out. addPathsToScan() puts the root-level configuration files back in, which is what proves the tools they configure. Pass false for $isDev when the tools are production requirements, true when they are development ones — the analyser reports a mismatch either way round.

Exclude the error, where the package is invisible to a symbol scan. The PHPStan packages are wired up through phpstan.neon and named in no PHP file, so ignoreErrorsOnPackage() excludes UNUSED_DEPENDENCY for each of them. There is no pattern equivalent, so a PHPStan extension added to a project is named individually.

Exclude the unknown class, where it cannot be autoloaded. ECS names its fixers and sniffs with the classes of friendsofphp/php-cs-fixer and squizlabs/php_codesniffer but requires neither, bundling both in a nested vendor tree behind an autoloader that is only registered once the tool boots. A configuration class naming a fixer therefore references a class that resolves at runtime and is unknown to the analyser, and ignoreUnknownClassesRegex() excludes the two namespaces wholesale.

One pattern covers both, and it has to. ECS's bootstrap.php is autoloaded eagerly but registers a lazy autoloader that acts only on a class named Symplify\… or ECSPrefix…; the first such class requested makes it load the nested vendor/autoload.php, and from that point PhpCsFixer\… resolves and is attributed to symplify/easy-coding-standard instead of being unknown. PHP_CodeSniffer\… stays unknown either way, being prefixed in that tree. So whether the fixers are unknown depends on whether a Symplify\ symbol was scanned before them, which differs between one filesystem and the next. Split across two patterns, the fixer one goes unmatched wherever the sniffs are scanned last — and since an unmatched ignore is itself an error, the check would pass locally and fail in CI. Joined, the sniffs alone match it.

Exclusions that never fire are reported in their own right, so treat the defaults as a starting point: a project with no PHPStan extension installed is told that the entry for it matched nothing.

Composer Scripts

Add to your composer.json:

Run QA checks:


Included Rule Sets

Rector (Code Modernization)

Set Description
UP_TO_PHP_83 Modernizes code to PHP 8.3 syntax
PHPUNIT_100 Upgrades PHPUnit to version 10.0+
CODE_QUALITY Simplifies expressions, removes redundancy
CODING_STYLE Enforces consistent style
DEAD_CODE Removes unused code
NAMING Improves naming conventions

ECS (Code Style)

Rule Description
DeclareStrictTypesFixer Adds declare(strict_types=1)
DisallowLongArraySyntaxSniff Enforces short array syntax []
StrictComparisonFixer Enforces === over ==
NoUnusedImportsFixer Removes unused imports
OrderedImportsFixer Alphabetizes imports
TrailingCommaInMultilineFixer Adds trailing commas

PHPStan (Static Analysis)

Composer Dependency Analyser (Dependency Hygiene)

Exclusion Description
phpstan/extension-installer Composer plugin, referenced from no PHP file
phpstan/phpstan Prefixed PHAR, configured through phpstan.neon rather than from code
phpstan/phpstan-phpunit Wired through phpstan.neon rather than referenced in code
phpstan/phpstan-strict-rules Wired through phpstan.neon rather than referenced in code
/^(PHP_CodeSniffer\|PhpCsFixer)\\/ Sniffs and fixers bundled inside the ECS vendor tree, unknown to the analyser

Only UNUSED_DEPENDENCY is excluded per package, so every other kind of error is still reported for them. rector/rector, shipmonk/composer-dependency-analyser and symplify/easy-coding-standard are deliberately absent: a scanned file references each one, which proves it used.


Customization

Extend any configuration class to modify defaults:

Use your custom class:


All versions of ctw-qa with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
phpstan/extension-installer Version ^1.4
phpstan/phpstan Version ^2.0
phpstan/phpstan-phpunit Version ^2.0
phpstan/phpstan-strict-rules Version ^2.0
rector/rector Version ^2.8.0
shipmonk/composer-dependency-analyser Version ^1.8.4
symplify/easy-coding-standard Version ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ctw/ctw-qa contains the following files

Loading the files please wait ...