PHPackages                             cyjimmy264/phpubocop - 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. cyjimmy264/phpubocop

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

cyjimmy264/phpubocop
====================

RuboCop-inspired style and lint checker for PHP

v0.1.0(3mo ago)018BSD-2-ClausePHPPHP &gt;=8.1

Since Mar 19Pushed 3mo agoCompare

[ Source](https://github.com/CyJimmy264/phpubocop)[ Packagist](https://packagist.org/packages/cyjimmy264/phpubocop)[ RSS](/packages/cyjimmy264-phpubocop/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

PHPuboCop
=========

[](#phpubocop)

PHPuboCop is a RuboCop-inspired linter for PHP projects.

Goals
-----

[](#goals)

- Bring Ruby-style strictness and consistency to PHP code.
- Keep rules composable and easy to extend.
- Work as a normal Composer library + executable binary.

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

[](#installation)

```
composer require --dev cyjimmy264/phpubocop
```

Usage
-----

[](#usage)

```
vendor/bin/phpubocop
vendor/bin/phpubocop src
vendor/bin/phpubocop src tests
vendor/bin/phpubocop src --format=json
vendor/bin/phpubocop src --config=.phpubocop.yml
vendor/bin/phpubocop src --autocorrect
vendor/bin/phpubocop src --autocorrect-all
vendor/bin/phpubocop src --verbose

# Allow Xdebug for debugging/profiling runs.
PHPUBOCOP_ALLOW_XDEBUG=1 vendor/bin/phpubocop src
```

`phpubocop` disables Xdebug by default by re-executing itself with `xdebug.mode=off`, because Xdebug significantly slows down lint runs. Set `PHPUBOCOP_ALLOW_XDEBUG=1` when you explicitly want to debug or profile the process.

Exit code:

- `0` if no offenses were found.
- `1` if at least one offense was found.
- Files ignored by the project's `.gitignore` are skipped automatically.
- `--autocorrect` applies only cops explicitly marked as safe for autocorrection.
- `--autocorrect-all` applies all autocorrectable cops, including unsafe ones.
- `--verbose` prints selected config source and file discovery stats to `STDERR`.
- Default text output uses RuboCop-like progress markers per file (`.`, `C`, `W`, `E`, `F`) plus detailed offense lines.

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

[](#configuration)

Create `.phpubocop.yml`:

```
AllCops:
  EnabledByDefault: true
  UseGitFileList: true
  Exclude:
    - vendor/**

Layout/LineLength:
  Enabled: true
  Max: 120

Layout/TrailingCommaInMultiline:
  Enabled: true

Layout/TrailingWhitespace:
  Enabled: true

Layout/IndentationStyle:
  Enabled: true
  Style: spaces
  TabWidth: 4

Style/DoubleQuotes:
  Enabled: true

Style/EmptyCatch:
  Enabled: true

Style/MultilineTernary:
  Enabled: true

Style/BooleanLiteralComparison:
  Enabled: true

Style/StrictComparison:
  Enabled: true

Security/Unserialize:
  Enabled: true

Security/Exec:
  Enabled: true

Security/EvalAndDynamicInclude:
  Enabled: true

Lint/DuplicateArrayKey:
  Enabled: true

Lint/DuplicateMethod:
  Enabled: true

Lint/EvalUsage:
  Enabled: true

Lint/SuppressedError:
  Enabled: true

Lint/ShadowingVariable:
  Enabled: true

Lint/UnreachableCode:
  Enabled: true

Lint/UselessAssignment:
  Enabled: true

Lint/UnusedVariable:
  Enabled: true
  IgnorePrefixedUnderscore: true
  IgnoreParameters: true

Metrics/AbcSize:
  Enabled: true
  Max: 17

Metrics/CyclomaticComplexity:
  Enabled: true
  Max: 7

Metrics/MethodLength:
  Enabled: true
  Max: 20
  CountAsOne:
    - array
    - heredoc
    - call_chain

Metrics/PerceivedComplexity:
  Enabled: true
  Max: 8

Metrics/ParameterLists:
  Enabled: true
  Max: 5
```

Included cops (MVP)
-------------------

[](#included-cops-mvp)

- `Layout/TrailingWhitespace`
- `Layout/LineLength`
- `Layout/TrailingCommaInMultiline`
- `Layout/IndentationStyle`
- `Style/DoubleQuotes`
- `Style/EmptyCatch`
- `Style/MultilineTernary`
- `Style/BooleanLiteralComparison`
- `Style/StrictComparison`
- `Security/Unserialize`
- `Security/Exec`
- `Security/EvalAndDynamicInclude`
- `Lint/DuplicateArrayKey`
- `Lint/DuplicateMethod`
- `Lint/EvalUsage`
- `Lint/SuppressedError`
- `Lint/ShadowingVariable`
- `Lint/UnreachableCode`
- `Lint/UselessAssignment`
- `Lint/UnusedVariable`
- `Metrics/AbcSize`
- `Metrics/CyclomaticComplexity`
- `Metrics/MethodLength`
- `Metrics/PerceivedComplexity`
- `Metrics/ParameterLists`
- `Architecture/ThinLayerBoundary`
- `Architecture/ThinLayerComplexity`
- `Architecture/ThinLayerLength`
- `Architecture/ThinLayerSuperglobalUsage`
- `Architecture/ThinLayerForbiddenFunctions`
- `Architecture/ThinLayerForbiddenMethodCalls`
- `Architecture/ThinLayerGlobalStateUsage`
- `Architecture/ThinLayerIncludeUsage`
- `Architecture/ThinLayerForbiddenStaticCalls`

Thin-layer family documentation: [docs/thin-layer-cops.md](docs/thin-layer-cops.md)

Architecture
------------

[](#architecture)

- `CopInterface` defines one rule.
- `Runner` applies enabled cops to discovered PHP files.
- `ConfigLoader` merges defaults with `.phpubocop.yml`.
- Formatters output in text or JSON.

Roadmap
-------

[](#roadmap)

- Auto-correct support (`--autocorrect`) for safe cops.
- Namespaced cop packs (e.g. `Rails`, `Laravel`, `Doctrine`).
- More style cops that mirror RuboCop semantics where meaningful in PHP.
- Baseline file support for incremental adoption.
- SARIF and GitHub Actions annotations.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance82

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

96d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b68db2d9303aeeb6aa402265abadb52389d8fa5d7af1daa1d1a8793678fc9c9?d=identicon)[CyJimmy264](/maintainers/CyJimmy264)

---

Top Contributors

[![CyJimmy264](https://avatars.githubusercontent.com/u/962057?v=4)](https://github.com/CyJimmy264 "CyJimmy264 (81 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cyjimmy264-phpubocop/health.svg)

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

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k100.2M2.1k](/packages/behat-behat)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k16.3M975](/packages/phpro-grumphp)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k41.3M38.7k](/packages/orchestra-testbench)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9184.1M24](/packages/phparkitect-phparkitect)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)

PHPackages © 2026

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