You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-12Lines changed: 18 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
- ⚙️ **Configurable:** Fine-grained ignores via PHP config
6
6
- 🕸️ **Lightweight:** No composer dependencies
7
7
- 🍰 **Easy-to-use:** No config needed for first try
8
-
- ✨ **Compatible:** PHP 7.2 - 8.3
8
+
- ✨ **Compatible:** PHP 7.2 - 8.3
9
9
10
10
## Comparison:
11
11
@@ -48,43 +48,49 @@ Found unused dependencies!
48
48
(scanned 13970 files in 2.297 s)
49
49
```
50
50
51
-
You can add `--verbose` to see more example classes & usages.
52
-
53
51
## Detected issues:
54
52
This tool reads your `composer.json` and scans all paths listed in `autoload` & `autoload-dev` sections while analysing:
55
53
56
54
### Shadowed dependencies
57
55
- Those are dependencies of your dependencies, which are not listed in `composer.json`
58
56
- Your code can break when your direct dependency gets updated to newer version which does not require that shadowed dependency anymore
59
57
- You should list all those packages within your dependencies
60
-
- Ignorable by `--ignore-shadow-deps` or more granularly by `--config`
61
58
62
59
### Unused dependencies
63
60
- Any non-dev dependency is expected to have at least single usage within the scanned paths
64
61
- To avoid false positives here, you might need to adjust scanned paths or ignore some packages by `--config`
65
-
- Ignorable by `--ignore-unused-deps` or more granularly by `--config`
66
62
67
63
### Dev dependencies in production code
68
64
- For libraries, this is risky as your users might not have those installed
69
65
- For applications, it can break once you run it with `composer install --no-dev`
70
66
- You should move those from `require-dev` to `require`
71
-
- Ignorable by `--ignore-dev-in-prod-deps` or more granularly by `--config`
72
67
73
68
### Prod dependencies used only in dev paths
74
69
- For libraries, this miscategorization can lead to uselessly required dependencies for your users
75
70
- You should move those from `require` to `require-dev`
76
-
- Ignorable by `--ignore-prod-only-in-dev-deps` or more granularly by `--config`
77
71
78
72
### Unknown classes
79
73
- Any class that cannot be autoloaded gets reported as we cannot say if that one is shadowed or not
80
-
- Ignorable by `--ignore-unknown-classes` or more granularly by `--config`
81
74
82
-
It is expected to run this tool in root of your project, where the `composer.json` is located.
83
-
If you want to run it elsewhere, you can use `--composer-json=path/to/composer.json` option.
75
+
76
+
## Cli options:
77
+
-`--composer-json path/to/composer.json` for custom path to composer.json
78
+
-`--dump-usages symfony/console` to show usages of certain package(s), `*` placeholder is supported
79
+
-`--config path/to/config.php` for custom path to config file
80
+
-`--help` display usage & cli options
81
+
-`--verbose` to see more example classes & usages
82
+
-`--show-all-usages` to see all usages
83
+
-`--ignore-unknown-classes` to globally ignore unknown classes
84
+
-`--ignore-shadow-deps` to globally ignore shadow dependencies
85
+
-`--ignore-unused-deps` to globally ignore unused dependencies
86
+
-`--ignore-dev-in-prod-deps` to globally ignore dev dependencies in prod code
87
+
-`--ignore-prod-only-in-dev-deps` to globally ignore prod dependencies used only in dev paths
88
+
84
89
85
90
## Configuration:
86
-
You can provide custom path to config file by `--config=path/to/config.php` where the config file is PHP file returning `ShipMonk\ComposerDependencyAnalyser\Config\Configuration` object.
87
-
It gets loaded automatically if it is located in cwd as `composer-dependency-analyser.php`.
91
+
When a file named `composer-dependency-analyser.php` is located in cwd, it gets loaded automatically.
92
+
The file must return `ShipMonk\ComposerDependencyAnalyser\Config\Configuration` object.
93
+
You can use custom path and filename via `--config` cli option.
0 commit comments