Skip to content

matraux/php-code-style

Repository files navigation

MATRAUX PHP code style

Latest Version on Packagist Last release License: MIT PHP Security Policy Contributing QA Status Issues Last Commit


Introduction

A PHP 8.4+ library that provides the shared MATRAUX PHP-CS-Fixer configuration. It exposes a ready-to-use ConfigFactory for project .php-cs-fixer.dist.php files and reusable Rules presets for custom configurations.

Useful for keeping code style, imports, strict typing, class layout, PHPDoc cleanup, indentation, and line endings consistent across multiple PHP packages.


Features

  • Ready-to-use PHP-CS-Fixer configuration via ConfigFactory::create()
  • Reusable rules through Rules::All and grouped rule sets
  • PER-CS baseline with automatic PHP migration rules
  • Strict typing, strict comparisons, strict parameters, and function alias cleanup
  • Import ordering, unused import removal, and fully qualified type normalization
  • Class member ordering and class element separation
  • Tabs and LF line endings configured by default
  • Risky PHP-CS-Fixer rules enabled explicitly
  • Stable cache file per configured path set

Installation

composer require --dev matraux/php-code-style

Requirements

version PHP Note
1.0.0 7.4+ Support PHP 7.4
2.0.0 8.3+ Support PHP 8.3
3.0.0 8.4+ Support PHP 8.4

Examples

Create file .php-cs-fixer.dist.php or .php-cs-fixer.php in root.

<?php declare(strict_types=1);

use Matraux\PhpCodeStyle\ConfigFactory;

return ConfigFactory::create(
	__DIR__ . '/src',
);

Run code style check

vendor/bin/php-cs-fixer check

Run code style fixer

vendor/bin/php-cs-fixer fix

Development

See Development for debug, static analysis, and coding standards.


Support

For bug reports and feature requests, please use the issue tracker.

About

A PHP 8.4+ library providing reusable PHP-CS-Fixer rules and shared code style configuration.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages