From 52254cf5eaa7726ba5e73c6b5fa40b952dfb61ad Mon Sep 17 00:00:00 2001 From: leocavalcante Date: Sat, 23 Dec 2023 02:15:11 -0300 Subject: [PATCH] chore(examples/box): Using minicli --- examples/box/README.md | 7 +++-- examples/box/composer.json | 5 +++- examples/box/composer.lock | 60 ++++++++++++++++++++++++++++++++++++-- examples/box/main | 24 +++++++++++++-- rootfs/etc/php/php.ini | 5 ++-- 5 files changed, 92 insertions(+), 9 deletions(-) diff --git a/examples/box/README.md b/examples/box/README.md index 6e9fdd2..6a918b9 100644 --- a/examples/box/README.md +++ b/examples/box/README.md @@ -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. \ No newline at end of file +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. diff --git a/examples/box/composer.json b/examples/box/composer.json index 0480850..11ac6f5 100644 --- a/examples/box/composer.json +++ b/examples/box/composer.json @@ -10,5 +10,8 @@ } ], "minimum-stability": "stable", - "bin": ["main"] + "bin": ["main"], + "require": { + "minicli/minicli": "^4.2" + } } diff --git a/examples/box/composer.lock b/examples/box/composer.lock index fa7a369..ab72a62 100644 --- a/examples/box/composer.lock +++ b/examples/box/composer.lock @@ -4,8 +4,64 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "431b1cbf53653d3c4972318c5517c7d9", - "packages": [], + "content-hash": "8c29a580845cfe8ac98268cb12caf54d", + "packages": [ + { + "name": "minicli/minicli", + "version": "4.2.0", + "source": { + "type": "git", + "url": "https://github.com/minicli/minicli.git", + "reference": "1675c0609205c106bb7c2353888dec361808d92e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minicli/minicli/zipball/1675c0609205c106bb7c2353888dec361808d92e", + "reference": "1675c0609205c106bb7c2353888dec361808d92e", + "shasum": "" + }, + "require": { + "ext-readline": "*", + "php": ">=8.1" + }, + "require-dev": { + "laravel/pint": "^1.10", + "mockery/mockery": "^1.5", + "pestphp/pest": "^2.5", + "phpstan/phpstan": "^1.10" + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Minicli\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Experimental micro CLI framework for PHP", + "homepage": "https://github.com/minicli/minicli", + "keywords": [ + "cli", + "command-line" + ], + "support": { + "issues": "https://github.com/minicli/minicli/issues", + "source": "https://github.com/minicli/minicli/tree/4.2.0" + }, + "funding": [ + { + "url": "https://github.com/erikaheidi", + "type": "github" + } + ], + "time": "2023-06-27T08:16:45+00:00" + } + ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", diff --git a/examples/box/main b/examples/box/main index 32ebda7..e42be79 100755 --- a/examples/box/main +++ b/examples/box/main @@ -1,6 +1,26 @@ #!/usr/bin/env php [ + __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); diff --git a/rootfs/etc/php/php.ini b/rootfs/etc/php/php.ini index 1ae97ab..fb4f982 100644 --- a/rootfs/etc/php/php.ini +++ b/rootfs/etc/php/php.ini @@ -1,5 +1,3 @@ -;zend_extension = xdebug - [xdebug] xdebug.mode = develop,debug xdebug.log = /tmp/xdebug.log @@ -7,3 +5,6 @@ xdebug.start_with_request = Yes [swoole] swoole.use_shortname = Off + +[phar] +phar.readonly = Off