diff --git a/composer.json b/composer.json index a64197a6..0211ed05 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,6 @@ }, "autoload": { "psr-4": { - "Acelaya\\UrlShortener\\": "src", "Shlinkio\\Shlink\\CLI\\": "module/CLI/src", "Shlinkio\\Shlink\\Rest\\": "module/Rest/src", "Shlinkio\\Shlink\\Core\\": "module/Core/src", @@ -46,7 +45,6 @@ }, "autoload-dev": { "psr-4": { - "AcelayaTest\\UrlShortener\\": "tests", "ShlinkioTest\\Shlink\\CLI\\": "module/CLI/test", "ShlinkioTest\\Shlink\\Rest\\": "module/Rest/test", "ShlinkioTest\\Shlink\\Core\\": "module/Core/test", diff --git a/config/autoload/services.global.php b/config/autoload/services.global.php index 00304e5f..dc99033c 100644 --- a/config/autoload/services.global.php +++ b/config/autoload/services.global.php @@ -1,7 +1,4 @@ Container\TemplatedErrorHandlerFactory::class, Template\TemplateRendererInterface::class => Twig\TwigRendererFactory::class, - - // Services - Service\UrlShortener::class => AnnotatedFactory::class, - Service\VisitsTracker::class => AnnotatedFactory::class, - Service\ShortUrlService::class => AnnotatedFactory::class, - - // Middleware - Middleware\Routable\RedirectMiddleware::class => AnnotatedFactory::class, ], 'aliases' => [ Router\RouterInterface::class => Router\FastRouteRouter::class, diff --git a/config/config.php b/config/config.php index 5b1fedf9..736b8fd4 100644 --- a/config/config.php +++ b/config/config.php @@ -1,6 +1,7 @@ 'long-url-redirect', 'path' => '/{shortCode}', - 'middleware' => Routable\RedirectMiddleware::class, + 'middleware' => RedirectMiddleware::class, 'allowed_methods' => ['GET'], ], ], diff --git a/module/Core/config/services.config.php b/module/Core/config/services.config.php new file mode 100644 index 00000000..cab7ca41 --- /dev/null +++ b/module/Core/config/services.config.php @@ -0,0 +1,20 @@ + [ + 'factories' => [ + // Services + Service\UrlShortener::class => AnnotatedFactory::class, + Service\VisitsTracker::class => AnnotatedFactory::class, + Service\ShortUrlService::class => AnnotatedFactory::class, + + // Middleware + RedirectMiddleware::class => AnnotatedFactory::class, + ], + ], + +]; diff --git a/src/Middleware/Routable/RedirectMiddleware.php b/module/Core/src/Action/RedirectMiddleware.php similarity index 91% rename from src/Middleware/Routable/RedirectMiddleware.php rename to module/Core/src/Action/RedirectMiddleware.php index 85b42eb6..5b1907ca 100644 --- a/src/Middleware/Routable/RedirectMiddleware.php +++ b/module/Core/src/Action/RedirectMiddleware.php @@ -1,13 +1,13 @@