mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-22 15:13:59 -06:00
Added CLI entry point
This commit is contained in:
parent
f248d44e68
commit
b20654ee2d
14
bin/cli
Normal file
14
bin/cli
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
use Zend\Diactoros\ServerRequestFactory;
|
||||
use Zend\Diactoros\Uri;
|
||||
use Zend\Expressive\Application;
|
||||
|
||||
/** @var Application $app */
|
||||
$app = include __DIR__ . '/../config/app.php';
|
||||
|
||||
$command = count($_SERVER['argv']) > 1 ? $_SERVER['argv'][1] : '';
|
||||
$request = ServerRequestFactory::fromGlobals()
|
||||
->withMethod('CLI')
|
||||
->withUri(new Uri(sprintf('/%s', $command)));
|
||||
$app->run($request);
|
@ -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'],
|
||||
],
|
||||
],
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user