diff --git a/bin/cli b/bin/cli new file mode 100644 index 00000000..1aa55f63 --- /dev/null +++ b/bin/cli @@ -0,0 +1,14 @@ +#!/usr/bin/env php + 1 ? $_SERVER['argv'][1] : ''; +$request = ServerRequestFactory::fromGlobals() + ->withMethod('CLI') + ->withUri(new Uri(sprintf('/%s', $command))); +$app->run($request); diff --git a/config/autoload/routes.global.php b/config/autoload/routes.global.php index 773f3e87..992f5656 100644 --- a/config/autoload/routes.global.php +++ b/config/autoload/routes.global.php @@ -14,12 +14,12 @@ return [ ], [ 'name' => 'cli', - 'path' => 'command-name', + 'path' => '/command-name', 'middleware' => function ($req, $resp) { $resp->getBody()->write('Hello world from cli'); return $resp; }, - 'allowed_methods' => ['GET'], + 'allowed_methods' => ['CLI'], ], ],