22
33# PHP Matrix
44
5- [ ![ Packagist Version] ( https://img.shields.io/packagist/v/typisttech/php-matrix )] ( https://packagist.org/packages/typisttech/php-matrix )
6- [ ![ PHP Version Require] ( https://img.shields.io/packagist/dependency-v/typisttech/php-matrix/php )] ( https://github.com/typisttech/php-matrix/blob/main/composer.json )
5+ [ ![ GitHub Release] ( https://img.shields.io/github/v/release/typisttech/php-matrix )] ( https://github.com/typisttech/php-matrix/releases )
76[ ![ Test] ( https://github.com/typisttech/php-matrix/actions/workflows/test.yml/badge.svg )] ( https://github.com/typisttech/php-matrix/actions/workflows/test.yml )
87[ ![ codecov] ( https://codecov.io/gh/typisttech/php-matrix/graph/badge.svg?token=HV5UDLPMMQ )] ( https://codecov.io/gh/typisttech/php-matrix )
98[ ![ License] ( https://img.shields.io/github/license/typisttech/php-matrix.svg )] ( https://github.com/typisttech/php-matrix/blob/master/LICENSE )
2322
2423---
2524
25+ > [ !TIP]
26+ > ** Hire Tang Rufus!**
27+ >
28+ > I am looking for my next role, freelance or full-time.
29+ > If you find this tool useful, I can build you more weird stuffs like this.
30+ > Let's talk if you are hiring PHP / Ruby / Go developers.
31+ >
32+ > Contact me at https://typist.tech/contact/
33+
34+ ---
35+
2636## Usage
2737
38+ ### List PHP versions that satisfy the required PHP constraint in ` composer.json `
39+
2840``` console
29- $ php-matrix constraint " ^7 || ^8"
41+ $ cat ./composer.json
42+ {"require":{"php":"^7 || ^8"}}
43+
44+ $ php-matrix composer
3045{
3146 "constraint": "^7 || ^8",
3247 "versions": [
@@ -44,8 +59,13 @@ $ php-matrix constraint "^7 || ^8"
4459 "lowest": "7.0",
4560 "highest": "8.4"
4661}
62+ ```
63+
64+ ``` console
65+ $ cat ./some/path/to/the.json
66+ {"require":{"php":"~7.4.29 || ~8.1.29"}}
4767
48- $ php-matrix constraint --mode=full " ~7.4.29 || ~8.1.29 "
68+ $ php-matrix composer --source=php.net -- mode=full ./some/path/to/the.json
4969{
5070 "constraint": "~7.4.29 || ~8.1.29",
5171 "versions": [
@@ -55,59 +75,228 @@ $ php-matrix constraint --mode=full "~7.4.29 || ~8.1.29"
5575 "7.4.33",
5676 "8.1.29",
5777 "8.1.30",
58- "8.1.31"
78+ "8.1.31",
79+ "8.1.32",
80+ "8.1.33"
5981 ],
6082 "lowest": "7.4.29",
61- "highest": "8.1.31 "
83+ "highest": "8.1.33 "
6284}
85+ ```
86+
87+ ``` console
88+ $ php-matrix composer --help
89+ Description:
90+ List PHP versions that satisfy the required PHP constraint in composer.json
91+
92+ Usage:
93+ composer [options] [--] [<path>]
94+
95+ Arguments:
96+ path Path to composer.json file. [default: "./composer.json"]
97+
98+ Options:
99+ --source=SOURCE Available sources:
100+ - auto: Use offline in minor-only mode. Otherwise, fetch from php.net
101+ - php.net: Fetch releases information from php.net
102+ - offline: Use hardcoded releases information
103+ [default: "auto"]
104+ --mode=MODE Available modes:
105+ - full: Report all satisfying versions in MAJOR.MINOR.PATCH format
106+ - minor-only: Report MAJOR.MINOR versions only
107+ [default: "minor-only"]
108+ -h, --help Display help for the given command. When no command is given display help for the list command
109+ --silent Do not output any message
110+ -q, --quiet Only errors are displayed. All other output is suppressed
111+ -V, --version Display this application version
112+ --ansi|--no-ansi Force (or disable --no-ansi) ANSI output
113+ -n, --no-interaction Do not ask any interactive question
114+ -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
115+ ```
63116
64- $ php-matrix constraint --mode=minor-only " >=7.2 <8.4"
117+ ### List PHP versions that satisfy the given constraint
118+
119+ ``` console
120+ $ php-matrix constraint ' ^7 || ^8'
65121{
66- "constraint": ">=7.2 <8.4 ",
122+ "constraint": "^7 || ^8 ",
67123 "versions": [
124+ "7.0",
125+ "7.1",
68126 "7.2",
69127 "7.3",
70128 "7.4",
71129 "8.0",
72130 "8.1",
73131 "8.2",
74- "8.3"
132+ "8.3",
133+ "8.4"
75134 ],
76- "lowest": "7.2",
77- "highest": "8.3"
135+ "lowest": "7.0",
136+ "highest": "8.4"
137+ }
138+ ```
139+
140+ ``` console
141+ $ php-matrix constraint --source=php.net --mode=full ' ~7.4.29 || ~8.1.29'
142+ {
143+ "constraint": "~7.4.29 || ~8.1.29",
144+ "versions": [
145+ "7.4.29",
146+ "7.4.30",
147+ "7.4.32",
148+ "7.4.33",
149+ "8.1.29",
150+ "8.1.30",
151+ "8.1.31",
152+ "8.1.32",
153+ "8.1.33"
154+ ],
155+ "lowest": "7.4.29",
156+ "highest": "8.1.33"
78157}
79158```
80159
160+ ``` console
161+ $ php-matrix constraint --help
162+ Description:
163+ List PHP versions that satisfy the given constraint
164+
165+ Usage:
166+ constraint [options] [--] <constraint>
167+
168+ Arguments:
169+ constraint The version constraint.
170+
171+ Options:
172+ --source=SOURCE Available sources:
173+ - auto: Use offline in minor-only mode. Otherwise, fetch from php.net
174+ - php.net: Fetch releases information from php.net
175+ - offline: Use hardcoded releases information
176+ [default: "auto"]
177+ --mode=MODE Available modes:
178+ - full: Report all satisfying versions in MAJOR.MINOR.PATCH format
179+ - minor-only: Report MAJOR.MINOR versions only
180+ [default: "minor-only"]
181+ -h, --help Display help for the given command. When no command is given display help for the list command
182+ --silent Do not output any message
183+ -q, --quiet Only errors are displayed. All other output is suppressed
184+ -V, --version Display this application version
185+ --ansi|--no-ansi Force (or disable --no-ansi) ANSI output
186+ -n, --no-interaction Do not ask any interactive question
187+ -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
188+ ```
189+
81190### Options
82191
83192#### ` --mode `
84193
85194Available modes:
195+
86196- ` minor-only ` * (default)* : Report ` MAJOR.MINOR ` versions only
87197- ` full ` : Report all satisfying versions in ` MAJOR.MINOR.PATCH ` format
88198
89199#### ` --source `
90200
91201Available sources:
92- - ` auto ` * (default)* : Use ` offline ` in ` minor-only ` mode. Otherwise, fetch from [ php.net] ( https://www.php.net/releases/index.php )
202+
203+ - ` auto ` * (default)* : Use ` offline ` in
204+ ` minor-only ` mode. Otherwise, fetch from [ php.net] ( https://www.php.net/releases/index.php )
93205- ` php.net ` : Fetch releases information from [ php.net] ( https://www.php.net/releases/index.php )
94206- ` offline ` : Use [ hardcoded releases] ( ./data/all-versions.json ) information
95207
208+ > [ !TIP]
209+ > ** Hire Tang Rufus!**
210+ >
211+ > There is no need to understand any of these quirks.
212+ > Let me handle them for you.
213+ > I am seeking my next job, freelance or full-time.
214+ >
215+ > If you are hiring PHP / Ruby / Go developers,
216+ > contact me at https://typist.tech/contact/
217+
96218## Installation
97219
98- TODO!
220+ ### Homebrew (macOS / Linux) (Recommended)
221+
222+ ``` sh
223+ brew tap typisttech/tap
224+ brew install typisttech/tap/php-matrix
225+ ```
226+
227+ ### ` apt-get ` (Debian based distributions, for example: Ubuntu)
228+
229+ ``` sh
230+ curl -1sLf ' https://dl.cloudsmith.io/public/typisttech/oss/setup.deb.sh' | sudo -E bash
231+ sudo apt-get install php-matrix
232+ ```
233+
234+ Instead of the automatic setup script, you can manually configure the repository with the instructions on [ Cloudsmith] ( https://cloudsmith.io/~typisttech/repos/oss/setup/#formats-deb ) .
235+
236+ ### Manual ` .deb ` (Debian based distributions, for example: Ubuntu)
237+
238+ > [ !WARNING]
239+ > If you install the ` .deb ` file manually, you have to take care of updating it by yourself.
240+
241+ Download the latest ` .deb ` file from [ GitHub Releases] ( https://github.com/typisttech/php-matrix/releases/latest ) ,
242+ or via [ ` gh ` ] ( https://cli.github.com/ ) :
243+
244+ ``` sh
245+ # Both arm64 (aarch64) and amd64 (x86_64) architectures are available.
246+ gh release download --repo ' typisttech/php-matrix' --pattern ' php-matrix_linux_arm64.deb'
247+ ```
248+
249+ ** Optionally** , verify the ` .deb ` file:
250+
251+ ``` sh
252+ gh attestation verify --repo ' typisttech/php-matrix' ' php-matrix_linux_arm64.deb'
253+ ```
254+
255+ Finally, install the package:
256+
257+ ``` sh
258+ sudo dpkg -i php-matrix_linux_arm64.deb
259+ ```
260+
261+ ## Manual Binary
262+
263+ > [ !WARNING]
264+ > If you install the binary manually, you have to take care of updating it by yourself.
265+
266+ Download the latest ` .tar.gz ` file from [ GitHub Releases] ( https://github.com/typisttech/php-matrix/releases/latest ) ,
267+ or via [ ` gh ` ] ( https://cli.github.com/ ) :
268+
269+ ``` sh
270+ # Both darwin (macOS) and linux operating systems are available.
271+ # Both arm64 (aarch64) and amd64 (x86_64) architectures are available.
272+ gh release download --repo ' typisttech/php-matrix' --pattern ' php-matrix_darwin_arm64.tar.gz'
273+ ```
274+
275+ ** Optionally** , verify the ` .tar.gz ` file:
276+
277+ ``` sh
278+ gh attestation verify --repo ' typisttech/php-matrix' ' php-matrix_darwin_arm64.tar.gz'
279+ ```
280+
281+ Finally, unarchive and move the binary into ` $PATH ` :
282+
283+ ``` sh
284+ tar -xvf ' php-matrix_darwin_arm64.tar.gz'
285+
286+ # Or, move it to any directory under `$PATH`
287+ mv php-matrix /usr/local/bin
288+ ```
99289
100290## Credits
101291
102- [ ` PHP Matrix ` ] ( https://github.com/typisttech/php-matrix ) is a [ Typist Tech] ( https://typist.tech ) project and
103- maintained by [ Tang Rufus] ( https://x.com/TangRufus ) , freelance developer [ for hire] ( https://typist.tech/contact/ ) .
292+ [ ` PHP Matrix ` ] ( https://github.com/typisttech/php-matrix ) is a [ Typist Tech] ( https://typist.tech ) project and maintained by [ Tang Rufus] ( https://x.com/TangRufus ) , freelance developer [ for hire] ( https://typist.tech/contact/ ) .
104293
105294Full list of contributors can be found [ on GitHub] ( https://github.com/typisttech/php-matrix/graphs/contributors ) .
106295
107296## Copyright and License
108297
109- This project is a [ free software] ( https://www.gnu.org/philosophy/free-sw.en.html ) distributed under the terms of
110- the MIT license. For the full license, see [ LICENSE] ( ./LICENSE ) .
298+ This project is a [ free software] ( https://www.gnu.org/philosophy/free-sw.en.html ) distributed under the terms of the MIT license.
299+ For the full license, see [ LICENSE] ( ./LICENSE ) .
111300
112301## Contribute
113302
0 commit comments