PHPackages                             richcongress/static-analysis - 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. richcongress/static-analysis

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

richcongress/static-analysis
============================

A library to setup quickly the static analysis tools for RichCongress

v0.3.1(5mo ago)016.0k↓50%17MITPHPPHP ^8.1

Since Jun 23Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/rich-id/static-analysis)[ Packagist](https://packagist.org/packages/richcongress/static-analysis)[ RSS](/packages/richcongress-static-analysis/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (13)Used By (17)

Static analysis
===============

[](#static-analysis)

[![Package version](https://camo.githubusercontent.com/faca691d0cf4ef3d534a55646a4becbf1adfcfb6eae975a1b04b8111b8b80fc0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696368636f6e67726573732f7374617469632d616e616c79736973)](https://packagist.org/packages/richcongress/static-analysis)[![Contributions Welcome](https://camo.githubusercontent.com/9e93e892d0685e1bf7a1d0bd7c8410d6ecf2086a0a7b48dd58a6b96fa556ea2a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6e747269627574696f6e732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/richcongress/static-analysis/issues)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE.md)

The static analysis checks if the code fits the configured. In this repository, you'll find a default configuration, and a script to easily execute the static analysis.

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

[](#installation)

Execute the following command using composer: `composer require richcongress/static-analysis --dev`

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

[](#configuration)

#### Files

[](#files)

Create symlinks in the project folder that points to the configuration files:

```
ln -sr ./vendor/richcongress/static-analysis/configs/phpstan.neon ./
ln -sr ./vendor/richcongress/static-analysis/configs/phpinsights.php ./
ln -sr ./vendor/richcongress/static-analysis/configs/php-cs-fixer.dist.php ./.php-cs-fixer.dist.php
```

If you use this method in a bundle you will also want to exclude `phpinsights.php` from your autoloads in your `composer.json`:

```
{
    "autoload": {
        "exclude-from-classmap": ["phpinsights.php"]
    }
}

```

If you want rather copying files instead of creating a symlink, juste change `ln` by `cp`:

```
cp ./vendor/richcongress/static-analysis/configs/phpstan.neon ./
cp ./vendor/richcongress/static-analysis/configs/phpinsights.php ./
cp ./vendor/richcongress/static-analysis/configs/php-cs-fixer.dist.php ./.php-cs-fixer.dist.php
```

#### Git Hook

[](#git-hook)

To easily add a hook that execute the static analysis on `pre-push`, add the following code to your `composer.json` file:

```
{
    "scripts": {
        "post-install-cmd": [
            "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks add --ignore-lock"
        ],
        "post-update-cmd": [
            "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks update"
        ]
    },

    "extra": {
        "hooks": {
            "pre-commit": [
                "docker-compose exec -T application ./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix -n"
            ],
            "pre-push": [
                "docker-compose exec -T application ./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run -n",
                "docker-compose exec -T application ./vendor/richcongress/static-analysis/bin/static_analysis"
            ]
        }
    }
}

```

Note that if commit outside your docker container if you use one, it will be executed outside your container.

### PHP CS Fixer File Watcher

[](#php-cs-fixer-file-watcher)

You can setup a file watcher to run php-cs-fixer automatically on file save. For PhpStorm the config `configs/watcherTasks.xml` can be used as an example or if you don't have other watchers in your config, directly copy it to your `.idea/` folder:

```
cp ./vendor/richcongress/static-analysis/configs/watcherTasks.xml .idea/
```

Versioning
----------

[](#versioning)

static-analysis follows [semantic versioning](https://semver.org/). In short the scheme is MAJOR.MINOR.PATCH where

1. MAJOR is bumped when there is a breaking change,
2. MINOR is bumped when a new feature is added in a backward-compatible way,
3. PATCH is bumped when a bug is fixed in a backward-compatible way.

Versions bellow 1.0.0 are considered experimental and breaking changes may occur at any time.

Contributing
------------

[](#contributing)

Contributions are welcomed! There are many ways to contribute, and we appreciate all of them. Here are some of the major ones:

- [Bug Reports](https://github.com/richcongress/static-analysis/issues): While we strive for quality software, bugs can happen and we can't fix issues we're not aware of. So please report even if you're not sure about it or just want to ask a question. If anything the issue might indicate that the documentation can still be improved!
- [Feature Request](https://github.com/richcongress/static-analysis/issues): You have a use case not covered by the current api? Want to suggest a change or add something? We'd be glad to read about it and start a discussion to try to find the best possible solution.
- [Pull Request](https://github.com/richcongress/static-analysis/merge_requests): Want to contribute code or documentation? We'd love that! If you need help to get started, GitHub as [documentation](https://help.github.com/articles/about-pull-requests/) on pull requests. We use the ["fork and pull model"](https://help.github.com/articles/about-collaborative-development-models/) were contributors push changes to their personnal fork and then create pull requests to the main repository. Please make your pull requests against the `master` branch.

As a reminder, all contributors are expected to follow our [Code of Conduct](CODE_OF_CONDUCT.md).

License
-------

[](#license)

static-analysis is distributed under the terms of the MIT license.

See [LICENSE](LICENSE) for details.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance70

Regular maintenance activity

Popularity25

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~161 days

Recently: every ~135 days

Total

11

Last Release

172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6bfb5e4a3dde826e4cd3f92d24fdfbdce1415c77f3edd38fc3420b4988977e13?d=identicon)[HugoDumazeau](/maintainers/HugoDumazeau)

![](https://www.gravatar.com/avatar/8084ee0162a85df3b3f49230b8c0dde81108195caa541bb00642cbd050e88b25?d=identicon)[hudumazeau](/maintainers/hudumazeau)

---

Top Contributors

[![NicolasGuilloux](https://avatars.githubusercontent.com/u/4090627?v=4)](https://github.com/NicolasGuilloux "NicolasGuilloux (12 commits)")[![mdevlamynck](https://avatars.githubusercontent.com/u/4378377?v=4)](https://github.com/mdevlamynck "mdevlamynck (6 commits)")

### Embed Badge

![Health badge](/badges/richcongress-static-analysis/health.svg)

```
[![Health](https://phpackages.com/badges/richcongress-static-analysis/health.svg)](https://phpackages.com/packages/richcongress-static-analysis)
```

###  Alternatives

[ticketswap/phpstan-error-formatter

A minimalistic error formatter for PHPStan

87578.8k35](/packages/ticketswap-phpstan-error-formatter)[rich-davis1/phpw2v

A PHP implementation of Word2Vec, a popular word embedding algorithm created by Tomas Mikolov and popularized by Radim Řehůřek &amp; Peter Sojka with the Gensim Python library.

481.2k](/packages/rich-davis1-phpw2v)

PHPackages © 2026

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