2016-04-10 10:38:07 +03:00
|
|
|
<?php
|
2016-07-06 00:25:39 +03:00
|
|
|
use Acelaya\UrlShortener\CLI;
|
2016-04-30 18:21:35 +03:00
|
|
|
use Acelaya\UrlShortener\Factory\CacheFactory;
|
2016-04-17 21:27:24 +03:00
|
|
|
use Acelaya\UrlShortener\Factory\EntityManagerFactory;
|
2016-04-30 18:47:48 +03:00
|
|
|
use Acelaya\UrlShortener\Middleware;
|
2016-04-30 20:18:42 +03:00
|
|
|
use Acelaya\UrlShortener\Service;
|
2016-04-17 21:27:24 +03:00
|
|
|
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
2016-04-30 18:21:35 +03:00
|
|
|
use Doctrine\Common\Cache\Cache;
|
2016-04-17 21:27:24 +03:00
|
|
|
use Doctrine\ORM\EntityManager;
|
2016-07-06 00:25:39 +03:00
|
|
|
use Symfony\Component\Console;
|
|
|
|
use Zend\Expressive;
|
2016-04-10 10:38:07 +03:00
|
|
|
use Zend\Expressive\Container;
|
|
|
|
use Zend\Expressive\Helper;
|
|
|
|
use Zend\Expressive\Router;
|
|
|
|
use Zend\Expressive\Template;
|
2016-04-17 21:27:24 +03:00
|
|
|
use Zend\Expressive\Twig;
|
|
|
|
use Zend\ServiceManager\Factory\InvokableFactory;
|
2016-04-10 10:38:07 +03:00
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
'services' => [
|
|
|
|
'factories' => [
|
2016-07-06 00:25:39 +03:00
|
|
|
Expressive\Application::class => Container\ApplicationFactory::class,
|
|
|
|
Console\Application::class => CLI\Factory\ApplicationFactory::class,
|
2016-04-10 10:38:07 +03:00
|
|
|
|
2016-04-30 18:47:48 +03:00
|
|
|
// Url helpers
|
2016-04-10 10:38:07 +03:00
|
|
|
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
|
|
|
|
Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
|
|
|
|
Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,
|
2016-04-17 21:27:24 +03:00
|
|
|
Helper\ServerUrlHelper::class => InvokableFactory::class,
|
2016-04-30 19:59:03 +03:00
|
|
|
Router\FastRouteRouter::class => InvokableFactory::class,
|
2016-04-10 10:38:07 +03:00
|
|
|
|
|
|
|
// View
|
|
|
|
'Zend\Expressive\FinalHandler' => Container\TemplatedErrorHandlerFactory::class,
|
2016-04-17 21:27:24 +03:00
|
|
|
Template\TemplateRendererInterface::class => Twig\TwigRendererFactory::class,
|
|
|
|
|
|
|
|
// Services
|
|
|
|
EntityManager::class => EntityManagerFactory::class,
|
|
|
|
GuzzleHttp\Client::class => InvokableFactory::class,
|
2016-04-30 20:18:42 +03:00
|
|
|
Service\UrlShortener::class => AnnotatedFactory::class,
|
|
|
|
Service\VisitsTracker::class => AnnotatedFactory::class,
|
2016-06-18 10:43:29 +03:00
|
|
|
Service\ShortUrlService::class => AnnotatedFactory::class,
|
2016-07-04 15:45:18 +03:00
|
|
|
Service\RestTokenService::class => AnnotatedFactory::class,
|
2016-04-30 18:21:35 +03:00
|
|
|
Cache::class => CacheFactory::class,
|
2016-04-30 18:47:48 +03:00
|
|
|
|
2016-07-03 10:14:27 +03:00
|
|
|
// Cli commands
|
2016-07-06 00:25:39 +03:00
|
|
|
CLI\Command\GenerateShortcodeCommand::class => AnnotatedFactory::class,
|
|
|
|
CLI\Command\ResolveUrlCommand::class => AnnotatedFactory::class,
|
2016-07-06 20:41:24 +03:00
|
|
|
CLI\Command\ListShortcodesCommand::class => AnnotatedFactory::class,
|
2016-07-03 10:14:27 +03:00
|
|
|
|
2016-04-30 18:47:48 +03:00
|
|
|
// Middleware
|
2016-04-30 19:59:03 +03:00
|
|
|
Middleware\Routable\RedirectMiddleware::class => AnnotatedFactory::class,
|
2016-07-04 15:45:18 +03:00
|
|
|
Middleware\Rest\AuthenticateMiddleware::class => AnnotatedFactory::class,
|
2016-06-12 22:31:28 +03:00
|
|
|
Middleware\Rest\CreateShortcodeMiddleware::class => AnnotatedFactory::class,
|
|
|
|
Middleware\Rest\ResolveUrlMiddleware::class => AnnotatedFactory::class,
|
2016-06-12 22:51:06 +03:00
|
|
|
Middleware\Rest\GetVisitsMiddleware::class => AnnotatedFactory::class,
|
2016-06-18 10:43:29 +03:00
|
|
|
Middleware\Rest\ListShortcodesMiddleware::class => AnnotatedFactory::class,
|
2016-07-03 09:40:39 +03:00
|
|
|
Middleware\CrossDomainMiddleware::class => InvokableFactory::class,
|
2016-07-04 18:54:24 +03:00
|
|
|
Middleware\CheckAuthenticationMiddleware::class => AnnotatedFactory::class,
|
2016-04-10 10:38:07 +03:00
|
|
|
],
|
2016-04-17 21:27:24 +03:00
|
|
|
'aliases' => [
|
|
|
|
'em' => EntityManager::class,
|
|
|
|
'httpClient' => GuzzleHttp\Client::class,
|
2016-04-30 19:59:03 +03:00
|
|
|
Router\RouterInterface::class => Router\FastRouteRouter::class,
|
2016-06-12 22:51:06 +03:00
|
|
|
AnnotatedFactory::CACHE_SERVICE => Cache::class,
|
2016-04-17 21:27:24 +03:00
|
|
|
]
|
2016-04-10 10:38:07 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
];
|