Skip to content

Commit 52254cf

Browse files
committed
chore(examples/box): Using minicli
1 parent 1f525a0 commit 52254cf

File tree

5 files changed

+92
-9
lines changed

5 files changed

+92
-9
lines changed

examples/box/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ make
1717

1818
Then a `main.phar` will be generated:
1919
```shell
20-
./main.phar
20+
./main.phar test
2121
```
2222

23-
Head to the [Box project documentation](https://box-project.github.io/box/configuration/) to see the full and in details what you can do.
23+
Head to the [Box project documentation](https://box-project.github.io/box/configuration/) to see the full and in details what you can do.
24+
25+
> [!NOTE]
26+
> This example is using [minicli](https://docs.minicli.dev/en/latest/) for demonstration purposes.

examples/box/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
}
1111
],
1212
"minimum-stability": "stable",
13-
"bin": ["main"]
13+
"bin": ["main"],
14+
"require": {
15+
"minicli/minicli": "^4.2"
16+
}
1417
}

examples/box/composer.lock

Lines changed: 58 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/box/main

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
#!/usr/bin/env php
22
<?php
33

4-
declare(strict_types=1);
4+
if(php_sapi_name() !== 'cli') {
5+
exit;
6+
}
57

6-
echo "Hello, phpctl + box\n";
8+
require __DIR__ . '/vendor/autoload.php';
9+
10+
use Minicli\App;
11+
12+
$app = new App([
13+
'app_path' => [
14+
__DIR__ . '/app/Command',
15+
],
16+
'theme' => '\Unicorn',
17+
'debug' => false,
18+
]);
19+
20+
$app->registerCommand('test', function () use ($app) {
21+
$app->success('Hello World!' , false);
22+
$app->info('With Background!' , true);
23+
$app->error('Quitting!', false);
24+
});
25+
26+
$app->runCommand($argv);

rootfs/etc/php/php.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
;zend_extension = xdebug
2-
31
[xdebug]
42
xdebug.mode = develop,debug
53
xdebug.log = /tmp/xdebug.log
64
xdebug.start_with_request = Yes
75

86
[swoole]
97
swoole.use_shortname = Off
8+
9+
[phar]
10+
phar.readonly = Off

0 commit comments

Comments
 (0)