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).
33
4- ` composer.json ` <== (synchronized) ==> ` /vendor `
4+ ` / composer.json` <== (synchronized) ==> ` /vendor `
55
66![ Code Analysis] ( https://github.com/jakubboucek/php-composer-consistency/workflows/Code%20Analysis/badge.svg )
77
88## About
99For 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.
1212
1313You 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!
1515
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
1717notify you and your colleagues to forgotten refresh it.
1818
1919## Usage
@@ -27,7 +27,7 @@ In your app just call `validate()` method:
2727ComposerConsistency::rootDir(__DIR__)->validate();
2828```
2929
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.
3131
3232![ Exception from Checker] ( https://cdn.jakub-boucek.cz/screenshot/190703-jptvw.png )
3333
@@ -41,11 +41,11 @@ ComposerConsistency::rootDir(__DIR__)
4141```
4242
4343### 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.
4747
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() ` .
4949
5050``` php
5151ComposerConsistency::rootDir(__DIR__)
@@ -54,7 +54,7 @@ ComposerConsistency::rootDir(__DIR__)
5454```
5555
5656### Error severity
57- When checker detects incosistence , it throws ` ComposerInconsitencyException ` .
57+ When the checker detects any inconsistency , it throws ` ComposerInconsitencyException ` .
5858
5959You can change exception throwing to emit user error by method ` errorMode($severity) ` where ` $severity ` is Severity of
6060emitted error, default is ` E_USER_ERROR ` , you can change it to any of ` E_USER ` family severity
@@ -74,7 +74,7 @@ ComposerConsistency::rootDir(__DIR__)
7474```
7575
7676### 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
7878compute vendor consistency. Default value: ` off ` .
7979
8080Turn on Strict mode:
@@ -84,18 +84,18 @@ ComposerConsistency::rootDir(__DIR__)
8484 ->validate();
8585```
8686
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,
9191is 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.
9494
9595### 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 ` .
9999
100100``` php
101101ComposerConsistency::rootDir(__DIR__)
@@ -104,15 +104,16 @@ ComposerConsistency::rootDir(__DIR__)
104104```
105105
106106### 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 ` .
110110
111111``` php
112112ComposerConsistency::rootDir(__DIR__)
113113 ->froze(__DIR__ . '/temp')
114114 ->validate();
115115```
116116
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