File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,14 @@ $stack = $detector->getStack('/path/to/an/unknown/stack/directory');
40
40
$stack; // null
41
41
```
42
42
43
+ You can also use the CLI to test it.
44
+
45
+ ```
46
+ php bin/detect.php ~/Prog/php/my_project/
47
+ Detected stack: laravel
48
+ Version: 10.19.0
49
+ ```
50
+
43
51
## Tests
44
52
45
53
```
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4
+
5
+ use Einenlum \PhpStackDetector \Detector ;
6
+
7
+ $ detector = Detector::create ();
8
+
9
+ $ directory = $ argv [1 ] ?? null ;
10
+ if (null === $ directory || !is_dir ($ directory )) {
11
+ echo 'Please provide a directory to scan ' . "\n" ;
12
+ exit (1 );
13
+ }
14
+
15
+ $ stack = $ detector ->getStack ($ directory );
16
+
17
+ if (null === $ stack ) {
18
+ echo 'No stack detected ' . "\n" ;
19
+ exit (0 );
20
+ }
21
+
22
+ echo 'Detected stack: ' . $ stack ->type ->value . "\n" ;
23
+ echo 'Version: ' . ($ stack ->version ?: 'Unknown version ' ) . "\n" ;
You can’t perform that action at this time.
0 commit comments