Added CLI entry point

This commit is contained in:
Alejandro Celaya
2016-04-16 12:57:11 +02:00
parent f248d44e68
commit b20654ee2d
2 changed files with 16 additions and 2 deletions

14
bin/cli Normal file
View 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);