PHPackages                             degraciamathieu/php-arguments-detector - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. degraciamathieu/php-arguments-detector

ActivePackage[Utility &amp; Helpers](/categories/utility)

degraciamathieu/php-arguments-detector
======================================

Keep control over the complexity of your methods by checking that they do not have too many arguments.

v0.5.0(3y ago)1387715MITPHPPHP ^7.3 || ^7.4 || ^8.0

Since Aug 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/DeGraciaMathieu/php-arguments-detector)[ Packagist](https://packagist.org/packages/degraciamathieu/php-arguments-detector)[ Docs](https://github.com/DeGraciaMathieu/php-arguments-detector)[ RSS](/packages/degraciamathieu-php-arguments-detector/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (1)Dependencies (5)Versions (9)Used By (5)

[![build](https://github.com/DeGraciaMathieu/php-arguments-detector/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/DeGraciaMathieu/php-arguments-detector/actions/workflows/build.yml)[![packagist](https://camo.githubusercontent.com/b22e0be6264d9df80d884b3c4e91dc26b6a59c62f9b49bac891528c49f184e4e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f44654772616369614d6174686965752f7068702d617267756d656e74732d6465746563746f72)](https://camo.githubusercontent.com/b22e0be6264d9df80d884b3c4e91dc26b6a59c62f9b49bac891528c49f184e4e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f44654772616369614d6174686965752f7068702d617267756d656e74732d6465746563746f72)[![packagist](https://camo.githubusercontent.com/e46bd9e4df1b2c0467b03675b74b5f7665318e6114125429ef16dcc500ba552d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70687025323076657273696f6e732d372e33253230253743253230372e34253230253743253230253545382d626c7565)](https://camo.githubusercontent.com/e46bd9e4df1b2c0467b03675b74b5f7665318e6114125429ef16dcc500ba552d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70687025323076657273696f6e732d372e33253230253743253230372e34253230253743253230253545382d626c7565)

php arguments detector
======================

[](#php-arguments-detector)

> The ideal number of arguments for a function is zero. ~ Robert C. Martin

Keep control over the complexity of your methods by checking that they do not have too many arguments with this package.

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

[](#installation)

Requires &gt;= PHP 7.3

```
composer require degraciamathieu/php-arguments-detector --dev

```

Usage
-----

[](#usage)

```
vendor/bin/phpargsdetector inspect {folder}

```

Options
-------

[](#options)

optionsdescription--min-args=Ignore methods with less than --min-args arguments.--max-args=Ignore methods with more than --max-args arguments.--min-weight=Ignore methods with less than --min-weight weight.--max-weight=Ignore methods with more than --max-weight weight.--limit=Number of methods displayed.--without-constructorIgnore method constructors from detection.--sort-by-weightSort the results by the weight of methods.Examples
--------

[](#examples)

```
vendor/bin/phpargsdetector inspect app/Services/Saml/

+------------------------------------------+------------------+-----------+--------+
| Files                                    | Methods          | Arguments | Weight |
+------------------------------------------+------------------+-----------+--------+
| app/Services/Saml/SamlMessageFactory.php | __construct      | 2         | 2      |
| app/Services/Saml/SamlMessageFactory.php | makeSamlResponse | 2         | 68     |
| app/Services/Saml/SamlSecurity.php       | checkSignature   | 2         | 18     |
| app/Services/Saml/SamlIssuer.php         | find             | 1         | 3      |
| app/Services/Saml/SamlKeeper.php         | keep             | 1         | 1      |
| app/Services/Saml/SamlMessageFactory.php | addAttributes    | 1         | 26     |
| app/Services/Saml/SamlMessageFactory.php | sign             | 1         | 12     |
| app/Services/Saml/SamlResponder.php      | launch           | 1         | 10     |
| app/Services/Saml/SamlKeeper.php         | has              | 0         | 0      |
| app/Services/Saml/SamlKeeper.php         | retrieve         | 0         | 0      |
+------------------------------------------+------------------+-----------+--------+
Total of methods : 10

```

```
vendor/bin/phpargsdetector inspect app/ --limit=3 --min-args=2 --without-constructor

+-------------------------------------------------+---------+-----------+--------+
| Files                                           | Methods | Arguments | Weight |
+-------------------------------------------------+---------+-----------+--------+
| app/Http/Middleware/RedirectIfAuthenticated.php | handle  | 3         | 27     |
| app/Http/Controllers/IssuerController.php       | update  | 2         | 24     |
| app/Http/Controllers/RestrictionController.php  | update  | 2         | 28     |
+-------------------------------------------------+---------+-----------+--------+
Total of methods : 3

```

```
vendor/bin/phpargsdetector inspect app/ --limit=3 --sort-by-weight

+-------------------------------------------------+------------------+-----------+--------+
| Files                                           | Methods          | Arguments | Weight |
+-------------------------------------------------+------------------+-----------+--------+
| app/Services/Saml/SamlMessageFactory.php        | makeSamlResponse | 2         | 68     |
| app/Http/Controllers/RestrictionController.php  | update           | 2         | 28     |
| app/Http/Middleware/RedirectIfAuthenticated.php | handle           | 3         | 27     |
+-------------------------------------------------+------------------+-----------+--------+
Total of methods : 3

```

Weight
------

[](#weight)

The weight is the number of arguments multiplied by the number of lines of the method.

The weight of the `foo` method is 10 : 2 arguments \* 5 lines.

```
class Bar {
    public function foo($a, $b)
    {
        if ($a) {
           //
        }

        return $b;
    }
}
```

You can use it as a complexity indicator.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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

Every ~4 days

Total

8

Last Release

1346d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b7c883dad74109462c750a2bafef33c1d26da31c68e90b686cc0aa355b57feaf?d=identicon)[DeGraciaMathieu](/maintainers/DeGraciaMathieu)

---

Top Contributors

[![DeGraciaMathieu](https://avatars.githubusercontent.com/u/11473997?v=4)](https://github.com/DeGraciaMathieu "DeGraciaMathieu (43 commits)")

---

Tags

cimetricsphpqualitystatic-analyzer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/degraciamathieu-php-arguments-detector/health.svg)

```
[![Health](https://phpackages.com/badges/degraciamathieu-php-arguments-detector/health.svg)](https://phpackages.com/packages/degraciamathieu-php-arguments-detector)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M563](/packages/symfony-maker-bundle)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M81](/packages/symplify-monorepo-builder)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

5953.3M55](/packages/roave-backward-compatibility-check)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)

PHPackages © 2026

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