1
- # PHP Composer consitency checker
2
- Checks if the ` vendor/ ` directory is consistent with project's ` composer.lock ` (direct API, no CLI).
1
+ # PHP Composer consistency checker
2
+ Checks if the ` /vendor ` directory is consistent with the project's ` / composer.lock` (direct API, no CLI).
3
3
4
- ` composer.json ` <== (synchronized) ==> ` /vendor `
4
+ ` / composer.json` <== (synchronized) ==> ` /vendor `
5
5
6
6
![ Code Analysis] ( https://github.com/jakubboucek/php-composer-consistency/workflows/Code%20Analysis/badge.svg )
7
7
8
8
## About
9
9
For small teams can be difficult to cooperate and keep ` /vendor ` directory synchronized with requirements
10
- in ` composer.json ` . Your colleagues can be a junior or can be not accustomed to right use the Composer and often forgot
11
- to call ` composer install ` before running the App after update code from remote.
10
+ in ` / composer.json` . Your colleagues can be a junior or can be not accustomed to the right of use the Composer and
11
+ often forgot to call ` composer install ` before running the App after update code from remote.
12
12
13
13
You can force refresh Composer via git-hooks, but it requires careful preparation on each developer station.
14
- In other way you can push whole ` /vendor ` into your repo, but it's very very dirty way. Don't do it!
14
+ In another way, you can push the whole ` /vendor ` into your repo, but it's a very very dirty way. Don't do it!
15
15
16
- Or… just add this package to you project. It checks if you ` /vendor ` is consistent with project and can
16
+ Or… just add this package to you project. It checks if your ` /vendor ` is consistent with the project and can
17
17
notify you and your colleagues to forgotten refresh it.
18
18
19
19
## Usage
@@ -27,7 +27,7 @@ In your app just call `validate()` method:
27
27
ComposerConsistency::rootDir(__DIR__)->validate();
28
28
```
29
29
30
- When ` /vendor ` directory is not consistent with ` composer.json ` , checker throws an Exception.
30
+ When ` /vendor ` directory is not consistent with ` / composer.json` , checker throws an Exception.
31
31
32
32
![ Exception from Checker] ( https://cdn.jakub-boucek.cz/screenshot/190703-jptvw.png )
33
33
@@ -41,11 +41,11 @@ ComposerConsistency::rootDir(__DIR__)
41
41
```
42
42
43
43
### Directories
44
- - ** Root dir ** - directory which contains ` composer.json ` , rspt. ` composer.lock ` file,
45
- usually root directory od project.
46
- - ** Vendor dir ** - directory which contains Composer's ` autoload.php ` file.
44
+ - ** Root directory ** - directory which contains ` / composer.json` , rspt. ` / composer.lock` file, usually the root directory
45
+ of the project.
46
+ - ** Vendor directory ** - directory which contains Composer's ` autoload.php ` file.
47
47
48
- By default, checker is assumes Verdor dir at ` vendor/ ` from root dir , you can change by method ` vendorDir() ` .
48
+ By default, the checker is assuming Vendor dir at ` /vendor ` from root directory , you can change by method ` vendorDir() ` .
49
49
50
50
``` php
51
51
ComposerConsistency::rootDir(__DIR__)
@@ -54,7 +54,7 @@ ComposerConsistency::rootDir(__DIR__)
54
54
```
55
55
56
56
### Error severity
57
- When checker detects incosistence , it throws ` ComposerInconsitencyException ` .
57
+ When the checker detects any inconsistency , it throws ` ComposerInconsitencyException ` .
58
58
59
59
You can change exception throwing to emit user error by method ` errorMode($severity) ` where ` $severity ` is Severity of
60
60
emitted error, default is ` E_USER_ERROR ` , you can change it to any of ` E_USER ` family severity
@@ -74,7 +74,7 @@ ComposerConsistency::rootDir(__DIR__)
74
74
```
75
75
76
76
### Strict mode
77
- In strict mode Checker throws Exception when is unable to read Composer's files used to
77
+ In strict mode, the checker throws Exception when is unable to read Composer's files used to
78
78
compute vendor consistency. Default value: ` off ` .
79
79
80
80
Turn on Strict mode:
@@ -84,18 +84,18 @@ ComposerConsistency::rootDir(__DIR__)
84
84
->validate();
85
85
```
86
86
87
- Scrict mode is by default disabled, because:
88
- - it can break production if you ignore some files (like ` composer.lock ` ) during deploy -
89
- that's false positive,
90
- - is not important to guard these files, for example when is missing whole ` vendor/ ` directory,
87
+ Strict mode is by default disabled, because:
88
+ - it can break production if you ignore some files (like ` / composer.lock` ) during deploy -
89
+ that's a false positive,
90
+ - is not important to guard these files, for example when is missing the whole ` /vendor ` directory,
91
91
is unable to load this package too,
92
- - main purpose of package is watching to subtle nuances in packages consistency, not fatals
93
- in Composer's file system.
92
+ - the main purpose of the package is watching to subtle nuances in packages consistency, not fatal in the Composer's
93
+ file system.
94
94
95
95
### Cache
96
- Checking ` /vendor ` consistency on every request consume unnecessarily huge CPU power. Cache is storing last success
97
- validation result. It does not more check consistency until these files keep same content. It requires a path to
98
- temporary directory for saving necessary files. Default value: ` off ` .
96
+ Checking ` /vendor ` consistency on every request consumes unnecessarily huge CPU power. The cache is storing the last
97
+ success validation result. It does not more check consistency until these files keep the same content. It requires
98
+ a path to a temporary directory for saving necessary files. Default value: ` off ` .
99
99
100
100
``` php
101
101
ComposerConsistency::rootDir(__DIR__)
@@ -104,15 +104,16 @@ ComposerConsistency::rootDir(__DIR__)
104
104
```
105
105
106
106
### Froze mode
107
- Checking vendor consistency on every request consume unnecessarily huge CPU power. Froze mode is usable when you
108
- guarantee the deploy process to production is always purge the temp directory. It requires a path to temporary directory
109
- for saving necessary files. Recommended in production environment. Default value: ` off ` .
107
+ Checking ` / vendor` consistency on every request consumes unnecessarily huge CPU power. Froze mode is usable when you
108
+ guarantee the deploy process to production is always purge the temp directory. It requires a path to a temporary
109
+ directory for saving necessary files. Recommended in the production environment. Default value: ` off ` .
110
110
111
111
``` php
112
112
ComposerConsistency::rootDir(__DIR__)
113
113
->froze(__DIR__ . '/temp')
114
114
->validate();
115
115
```
116
116
117
- In Froze mode is vendor consistenty checked only once, then is state saved to temp directory and
118
- no more checks are performed until is temp directory purged. Difference
117
+ In Froze mode is vendor consistency checked only once, then is state saved to the temp directory and no more checks are
118
+ performed until is temp directory purged. The difference between ` cache ` and ` froze ` behavior is ` cache ` mode is
119
+ checking files if is not modified and ` froze ` does don't do it.
0 commit comments