Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Coupling Detector Laravel Package

akeneo/php-coupling-detector

Detect PHP coupling issues based on configurable rules by analyzing class use statements. Supports forbidden, discouraged, and only rules, with error/warning violations. Includes commands to detect violations and list unused requirements.

View on GitHub
Deep Wiki
Context7

Detect coupling problems

The detect command detects coupling problems for a given file or directory depending on the coupling rules that have been defined:

    php bin/php-coupling-detector detect /path/to/directory
    php bin/php-coupling-detector detect /path/to/file

The exit status of the detect command can be: 0 if no violations have been raised, 10 in case of warnings and 99 in case of errors.

You can save the configuration in a .php_cd file in the root directory of your project. The file must return an instance of Akeneo\CouplingDetector\Configuration\Configuration, which lets you configure the rules and the directories that need to be analyzed. Here is an example below:

   <?php

   $finder = new \Symfony\Component\Finder\Finder();
   $finder
       ->files()
       ->name('*.php')
       ->notPath('foo/bar/');

   $builder = new \Akeneo\CouplingDetector\RuleBuilder();
   
   $rules = [
       $builder->forbids(['bar', 'baz'])->in('foo'),
       $builder->discourages(['too'])->in('zoo'),
       $builder->only(['bla', 'ble', 'blu'])->in('bli'),
   ];

   return new \Akeneo\CouplingDetector\Configuration\Configuration($rules, $finder);
   ?>

You can also use the default finder implementation if you want to analyse all the PHP files of your directory:

   <?php
   
   $builder = new \Akeneo\CouplingDetector\RuleBuilder();
   
   $rules = [
       $builder->forbids(['bar', 'baz'])->in('foo'),
       $builder->discourages(['too'])->in('zoo'),
       $builder->only(['bla', 'ble', 'blu'])->in('bli'),
   ];

   return new \Akeneo\CouplingDetector\Configuration\Configuration(
       $rules,
       new \Akeneo\CouplingDetector\Configuration\DefaultFinder()
   );
   ?>

With the --config-file option you can specify the path to the .php_cd file:

    php bin/php-coupling-detector detect /path/to/dir --config-file=/path/to/my/own_configuration_file.php

With the --format option you can specify the output format:

    php bin/php-coupling-detector /path/to/dir --format=dot
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity