Skip to content

Commit

Permalink
chore(examples/box): Using minicli
Browse files Browse the repository at this point in the history
  • Loading branch information
leocavalcante committed Dec 23, 2023
1 parent 1f525a0 commit 52254cf
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 9 deletions.
7 changes: 5 additions & 2 deletions examples/box/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ make

Then a `main.phar` will be generated:
```shell
./main.phar
./main.phar test
```

Head to the [Box project documentation](https://box-project.github.io/box/configuration/) to see the full and in details what you can do.
Head to the [Box project documentation](https://box-project.github.io/box/configuration/) to see the full and in details what you can do.

> [!NOTE]
> This example is using [minicli](https://docs.minicli.dev/en/latest/) for demonstration purposes.
5 changes: 4 additions & 1 deletion examples/box/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
}
],
"minimum-stability": "stable",
"bin": ["main"]
"bin": ["main"],
"require": {
"minicli/minicli": "^4.2"
}
}
60 changes: 58 additions & 2 deletions examples/box/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions examples/box/main
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);
if(php_sapi_name() !== 'cli') {
exit;
}

echo "Hello, phpctl + box\n";
require __DIR__ . '/vendor/autoload.php';

use Minicli\App;

$app = new App([
'app_path' => [
__DIR__ . '/app/Command',
],
'theme' => '\Unicorn',
'debug' => false,
]);

$app->registerCommand('test', function () use ($app) {
$app->success('Hello World!' , false);
$app->info('With Background!' , true);
$app->error('Quitting!', false);
});

$app->runCommand($argv);
5 changes: 3 additions & 2 deletions rootfs/etc/php/php.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
;zend_extension = xdebug

[xdebug]
xdebug.mode = develop,debug
xdebug.log = /tmp/xdebug.log
xdebug.start_with_request = Yes

[swoole]
swoole.use_shortname = Off

[phar]
phar.readonly = Off

0 comments on commit 52254cf

Please sign in to comment.