Search by

oliup / oliup-cs-php

silassare

There is no license information available for the latest version (1.0.3) of this package.

Oliup PHP code style rules.

Package info

github.com/oliup-io/oliup-cs-php

pkg:composer/oliup/oliup-cs-php

Statistics

Installs: 6

Dependents: 7

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.3 2026-03-08 08:39 UTC

This package is auto-updated.

Last update: 2026-09-17 12:31:41 UTC


README

Oliup PHP coding standards - a unified code style ruleset for PHP 8.1+ projects, combining PHP_CodeSniffer and PHP-CS-Fixer.

Includes:

  • PSR-12 + PhpCsFixer rules via PHP-CS-Fixer
  • PHPCompatibility checks via PHP_CodeSniffer
  • Custom Oliup whitespace, array, and safety sniffs

Requirements

  • PHP ^8.1

Installation

Add the VCS repository to your project's composer.json:

"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/oliup-io/oliup-cs-php"
  }
]

Then run:

composer require oliup/oliup-cs-php --dev

Setup

Run the init command to generate config files in your project root:

vendor/bin/oliup-cs init

Two files will be created:

Commit both files to version control.

Adjust the testVersion in phpcs.xml.dist to match your project's minimum supported PHP version:

<config name="testVersion" value="8.1-"/>

Usage

Check for code style violations:

vendor/bin/oliup-cs check

Automatically fix violations:

vendor/bin/oliup-cs fix

CI

Dry-run fix - exits with a non-zero code if any violations are found:

vendor/bin/oliup-cs fix-ci

Customizing rules

Edit .php-cs-fixer.dist.php to add or override PHP-CS-Fixer rules:

$rules = [
    // add your project-specific rules here
];

return (new PhpCS())->mergeRules($finder, $rules)
                    ->setRiskyAllowed(true);

Edit phpcs.xml.dist to add or exclude PHP_CodeSniffer sniffs:

<ruleset>
    <file>src</file>
    <file>tests</file>
    <rule ref="vendor/oliup/oliup-cs-php/src"/>
    <config name="testVersion" value="8.1-"/>
</ruleset>

Learn more