Created CLI module

This commit is contained in:
Alejandro Celaya 2016-07-19 16:50:02 +02:00
parent 5eefaf3071
commit 95d0beea3c
12 changed files with 33 additions and 12 deletions

View File

@ -2,6 +2,7 @@
"name": "shlinkio/shlink",
"type": "project",
"homepage": "http://shlink.io",
"description": "A PHP-based URL shortener application with analytics and management",
"license": "MIT",
"authors": [
{
@ -36,12 +37,18 @@
},
"autoload": {
"psr-4": {
"Acelaya\\UrlShortener\\": "src"
"Acelaya\\UrlShortener\\": "src",
"Shlinkio\\Shlink\\CLI\\": "module/CLI/src",
"Shlinkio\\Shlink\\Rest\\": "module/Rest/src",
"Shlinkio\\Shlink\\Core\\": "module/Core/src"
}
},
"autoload-dev": {
"psr-4": {
"AcelayaTest\\UrlShortener\\": "tests"
"AcelayaTest\\UrlShortener\\": "tests",
"ShlinkioTest\\Shlink\\CLI\\": "module/CLI/test",
"ShlinkioTest\\Shlink\\Rest\\": "module/Rest/test",
"ShlinkioTest\\Shlink\\Core\\": "module/Core/test"
}
},
"scripts": {

View File

@ -1,5 +1,5 @@
<?php
use Acelaya\UrlShortener\CLI;
use Shlinkio\Shlink\CLI;
use Acelaya\UrlShortener\Factory\CacheFactory;
use Acelaya\UrlShortener\Factory\EntityManagerFactory;
use Acelaya\UrlShortener\Middleware;

View File

@ -4,7 +4,7 @@ use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Interop\Container\ContainerInterface;
/** @var ContainerInterface $container */
$container = include __DIR__ . '/config/container.php';
$container = include __DIR__ . '/container.php';
/** @var EntityManager $em */
$em = $container->get(EntityManager::class);

View File

@ -1,4 +1,5 @@
<?php
use Shlinkio\Shlink\CLI;
use Zend\Expressive\ConfigManager\ConfigManager;
use Zend\Expressive\ConfigManager\ZendConfigProvider;
@ -13,6 +14,7 @@ use Zend\Expressive\ConfigManager\ZendConfigProvider;
return call_user_func(function () {
$configManager = new ConfigManager([
CLI\Config\ConfigProvider::class,
new ZendConfigProvider('config/autoload/{{,*.}global,{,*.}local}.php')
], 'data/cache/app_config.php');

View File

@ -1,5 +1,5 @@
<?php
use Acelaya\UrlShortener\CLI\Command;
use Shlinkio\Shlink\CLI\Command;
return [

View File

@ -1,5 +1,5 @@
<?php
namespace Acelaya\UrlShortener\CLI\Command;
namespace Shlinkio\Shlink\CLI\Command;
use Acelaya\UrlShortener\Exception\InvalidUrlException;
use Acelaya\UrlShortener\Service\UrlShortener;

View File

@ -1,5 +1,5 @@
<?php
namespace Acelaya\UrlShortener\CLI\Command;
namespace Shlinkio\Shlink\CLI\Command;
use Acelaya\UrlShortener\Service\VisitsTracker;
use Acelaya\UrlShortener\Service\VisitsTrackerInterface;

View File

@ -1,5 +1,5 @@
<?php
namespace Acelaya\UrlShortener\CLI\Command;
namespace Shlinkio\Shlink\CLI\Command;
use Acelaya\UrlShortener\Paginator\Adapter\PaginableRepositoryAdapter;
use Acelaya\UrlShortener\Paginator\Util\PaginatorUtilsTrait;

View File

@ -1,5 +1,5 @@
<?php
namespace Acelaya\UrlShortener\CLI\Command;
namespace Shlinkio\Shlink\CLI\Command;
use Acelaya\UrlShortener\Exception\InvalidShortCodeException;
use Acelaya\UrlShortener\Service\UrlShortener;

View File

@ -0,0 +1,13 @@
<?php
namespace Shlinkio\Shlink\CLI\Config;
use Zend\Config\Factory;
use Zend\Stdlib\Glob;
class ConfigProvider
{
public function __invoke()
{
return Factory::fromFiles(Glob::glob(__DIR__ . '/../../config/{,*.}config.php', Glob::GLOB_BRACE));
}
}

View File

@ -1,5 +1,5 @@
<?php
namespace Acelaya\UrlShortener\CLI\Factory;
namespace Shlinkio\Shlink\CLI\Factory;
use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;

View File

@ -16,8 +16,7 @@
</rule>
<!-- Paths to check -->
<file>src</file>
<file>tests</file>
<file>module</file>
<file>config</file>
<file>public/index.php</file>
</ruleset>