2016-07-19 11:01:39 -05:00
|
|
|
<?php
|
2019-10-05 10:26:10 -05:00
|
|
|
|
2017-10-12 03:13:20 -05:00
|
|
|
declare(strict_types=1);
|
2017-07-22 06:48:30 -05:00
|
|
|
|
2018-12-01 14:38:29 -06:00
|
|
|
namespace Shlinkio\Shlink\Core;
|
|
|
|
|
2020-01-01 14:11:53 -06:00
|
|
|
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
2020-11-22 11:03:27 -06:00
|
|
|
use Laminas\ServiceManager\Factory\InvokableFactory;
|
2019-07-13 05:04:21 -05:00
|
|
|
use Psr\EventDispatcher\EventDispatcherInterface;
|
2022-12-13 12:37:02 -06:00
|
|
|
use Shlinkio\Shlink\Common\Doctrine\EntityRepositoryFactory;
|
2024-10-16 01:55:38 -05:00
|
|
|
use Shlinkio\Shlink\Core\Config\Options\NotFoundRedirectOptions;
|
2024-04-12 02:13:48 -05:00
|
|
|
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifier;
|
2020-10-22 11:12:22 -05:00
|
|
|
use Shlinkio\Shlink\Importer\ImportedLinksProcessorInterface;
|
2022-09-18 11:44:01 -05:00
|
|
|
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
|
2023-05-21 11:08:17 -05:00
|
|
|
use Symfony\Component\Lock;
|
2016-07-19 11:01:39 -05:00
|
|
|
|
|
|
|
return [
|
|
|
|
|
2016-07-31 09:30:05 -05:00
|
|
|
'dependencies' => [
|
2016-07-19 11:01:39 -05:00
|
|
|
'factories' => [
|
2021-02-08 14:38:19 -06:00
|
|
|
ErrorHandler\NotFoundTypeResolverMiddleware::class => ConfigAbstractFactory::class,
|
|
|
|
ErrorHandler\NotFoundTrackerMiddleware::class => ConfigAbstractFactory::class,
|
2019-11-23 03:25:12 -06:00
|
|
|
ErrorHandler\NotFoundRedirectHandler::class => ConfigAbstractFactory::class,
|
2020-11-22 11:03:27 -06:00
|
|
|
ErrorHandler\NotFoundTemplateHandler::class => InvokableFactory::class,
|
2018-12-01 14:38:29 -06:00
|
|
|
|
2024-10-24 01:49:58 -05:00
|
|
|
Config\Options\AppOptions::class => [Config\Options\AppOptions::class, 'fromEnv'],
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\DeleteShortUrlsOptions::class => [Config\Options\DeleteShortUrlsOptions::class, 'fromEnv'],
|
|
|
|
Config\Options\NotFoundRedirectOptions::class => [Config\Options\NotFoundRedirectOptions::class, 'fromEnv'],
|
|
|
|
Config\Options\RedirectOptions::class => [Config\Options\RedirectOptions::class, 'fromEnv'],
|
|
|
|
Config\Options\UrlShortenerOptions::class => [Config\Options\UrlShortenerOptions::class, 'fromEnv'],
|
|
|
|
Config\Options\TrackingOptions::class => [Config\Options\TrackingOptions::class, 'fromEnv'],
|
|
|
|
Config\Options\QrCodeOptions::class => [Config\Options\QrCodeOptions::class, 'fromEnv'],
|
|
|
|
Config\Options\RabbitMqOptions::class => [Config\Options\RabbitMqOptions::class, 'fromEnv'],
|
|
|
|
Config\Options\RobotsOptions::class => [Config\Options\RobotsOptions::class, 'fromEnv'],
|
2016-08-07 07:44:33 -05:00
|
|
|
|
2024-02-27 14:00:53 -06:00
|
|
|
RedirectRule\ShortUrlRedirectRuleService::class => ConfigAbstractFactory::class,
|
2024-02-24 16:10:08 -06:00
|
|
|
RedirectRule\ShortUrlRedirectionResolver::class => ConfigAbstractFactory::class,
|
|
|
|
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\UrlShortener::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\ShortUrlService::class => ConfigAbstractFactory::class,
|
2022-12-13 12:37:02 -06:00
|
|
|
ShortUrl\ShortUrlListService::class => ConfigAbstractFactory::class,
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\DeleteShortUrlService::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\ShortUrlResolver::class => ConfigAbstractFactory::class,
|
2023-05-14 05:00:08 -05:00
|
|
|
ShortUrl\ShortUrlVisitsDeleter::class => ConfigAbstractFactory::class,
|
2022-09-23 11:46:51 -05:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class => ConfigAbstractFactory::class,
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Helper\ShortUrlStringifier::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Transformer\ShortUrlDataTransformer::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Middleware\ExtraPathRedirectMiddleware::class => ConfigAbstractFactory::class,
|
2022-09-30 10:19:07 -05:00
|
|
|
ShortUrl\Middleware\TrimTrailingSlashMiddleware::class => ConfigAbstractFactory::class,
|
2022-12-13 12:37:02 -06:00
|
|
|
ShortUrl\Repository\ShortUrlListRepository::class => [
|
|
|
|
EntityRepositoryFactory::class,
|
|
|
|
ShortUrl\Entity\ShortUrl::class,
|
|
|
|
],
|
2022-12-14 07:38:22 -06:00
|
|
|
ShortUrl\Repository\CrawlableShortCodesQuery::class => [
|
|
|
|
EntityRepositoryFactory::class,
|
|
|
|
ShortUrl\Entity\ShortUrl::class,
|
|
|
|
],
|
2024-04-03 02:41:05 -05:00
|
|
|
ShortUrl\Repository\ExpiredShortUrlsRepository::class => [
|
|
|
|
EntityRepositoryFactory::class,
|
|
|
|
ShortUrl\Entity\ShortUrl::class,
|
|
|
|
],
|
2021-02-09 15:11:09 -06:00
|
|
|
|
|
|
|
Tag\TagService::class => ConfigAbstractFactory::class,
|
2024-11-09 02:25:01 -06:00
|
|
|
Tag\Repository\TagRepository::class => [EntityRepositoryFactory::class, Tag\Entity\Tag::class],
|
2021-02-09 15:11:09 -06:00
|
|
|
|
2020-09-27 02:53:12 -05:00
|
|
|
Domain\DomainService::class => ConfigAbstractFactory::class,
|
2016-07-19 11:01:39 -05:00
|
|
|
|
2021-02-09 15:11:09 -06:00
|
|
|
Visit\VisitsTracker::class => ConfigAbstractFactory::class,
|
2021-07-15 10:23:09 -05:00
|
|
|
Visit\RequestTracker::class => ConfigAbstractFactory::class,
|
2023-05-18 02:01:57 -05:00
|
|
|
Visit\VisitsDeleter::class => ConfigAbstractFactory::class,
|
2022-09-23 07:50:26 -05:00
|
|
|
Visit\Geolocation\VisitLocator::class => ConfigAbstractFactory::class,
|
|
|
|
Visit\Geolocation\VisitToLocationHelper::class => ConfigAbstractFactory::class,
|
2021-02-09 15:11:09 -06:00
|
|
|
Visit\VisitsStatsHelper::class => ConfigAbstractFactory::class,
|
2024-04-12 11:29:55 -05:00
|
|
|
Visit\Repository\VisitIterationRepository::class => [
|
2022-12-14 05:28:23 -06:00
|
|
|
EntityRepositoryFactory::class,
|
|
|
|
Visit\Entity\Visit::class,
|
|
|
|
],
|
2023-05-14 05:00:08 -05:00
|
|
|
Visit\Repository\VisitDeleterRepository::class => [
|
|
|
|
EntityRepositoryFactory::class,
|
|
|
|
Visit\Entity\Visit::class,
|
|
|
|
],
|
2024-03-26 17:26:44 -05:00
|
|
|
Visit\Listener\ShortUrlVisitsCountTracker::class => InvokableFactory::class,
|
2024-04-01 03:22:51 -05:00
|
|
|
Visit\Listener\OrphanVisitsCountTracker::class => InvokableFactory::class,
|
2021-02-09 15:11:09 -06:00
|
|
|
|
2020-10-25 07:20:34 -05:00
|
|
|
Util\DoctrineBatchHelper::class => ConfigAbstractFactory::class,
|
2020-11-10 11:08:25 -06:00
|
|
|
Util\RedirectResponseHelper::class => ConfigAbstractFactory::class,
|
2019-11-16 03:06:55 -06:00
|
|
|
|
2021-07-21 02:28:21 -05:00
|
|
|
Config\NotFoundRedirectResolver::class => ConfigAbstractFactory::class,
|
|
|
|
|
2017-07-22 06:48:30 -05:00
|
|
|
Action\RedirectAction::class => ConfigAbstractFactory::class,
|
2018-03-26 13:13:03 -05:00
|
|
|
Action\PixelAction::class => ConfigAbstractFactory::class,
|
2017-07-22 06:48:30 -05:00
|
|
|
Action\QrCodeAction::class => ConfigAbstractFactory::class,
|
2021-05-22 00:15:34 -05:00
|
|
|
Action\RobotsAction::class => ConfigAbstractFactory::class,
|
2018-12-01 14:38:29 -06:00
|
|
|
|
2022-07-27 02:38:47 -05:00
|
|
|
EventDispatcher\PublishingUpdatesGenerator::class => ConfigAbstractFactory::class,
|
2020-10-22 11:12:22 -05:00
|
|
|
|
|
|
|
Importer\ImportedLinksProcessor::class => ConfigAbstractFactory::class,
|
2021-05-22 00:15:34 -05:00
|
|
|
|
2021-05-22 02:34:42 -05:00
|
|
|
Crawling\CrawlingHelper::class => ConfigAbstractFactory::class,
|
2023-11-15 12:57:58 -06:00
|
|
|
|
2024-10-16 01:55:38 -05:00
|
|
|
Matomo\MatomoOptions::class => [Matomo\MatomoOptions::class, 'fromEnv'],
|
2023-11-15 12:57:58 -06:00
|
|
|
Matomo\MatomoTrackerBuilder::class => ConfigAbstractFactory::class,
|
2024-04-12 02:13:48 -05:00
|
|
|
Matomo\MatomoVisitSender::class => ConfigAbstractFactory::class,
|
2020-10-22 11:12:22 -05:00
|
|
|
],
|
|
|
|
|
|
|
|
'aliases' => [
|
|
|
|
ImportedLinksProcessorInterface::class => Importer\ImportedLinksProcessor::class,
|
2016-07-19 11:01:39 -05:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
2017-07-22 06:48:30 -05:00
|
|
|
ConfigAbstractFactory::class => [
|
2023-11-15 12:57:58 -06:00
|
|
|
Matomo\MatomoTrackerBuilder::class => [Matomo\MatomoOptions::class],
|
2024-04-13 02:55:40 -05:00
|
|
|
Matomo\MatomoVisitSender::class => [
|
|
|
|
Matomo\MatomoTrackerBuilder::class,
|
|
|
|
ShortUrlStringifier::class,
|
|
|
|
Visit\Repository\VisitIterationRepository::class,
|
|
|
|
],
|
2023-11-15 12:57:58 -06:00
|
|
|
|
2021-02-08 14:38:19 -06:00
|
|
|
ErrorHandler\NotFoundTypeResolverMiddleware::class => ['config.router.base_path'],
|
2021-07-15 10:23:09 -05:00
|
|
|
ErrorHandler\NotFoundTrackerMiddleware::class => [Visit\RequestTracker::class],
|
2020-11-10 11:08:25 -06:00
|
|
|
ErrorHandler\NotFoundRedirectHandler::class => [
|
|
|
|
NotFoundRedirectOptions::class,
|
2021-07-21 02:28:21 -05:00
|
|
|
Config\NotFoundRedirectResolver::class,
|
|
|
|
Domain\DomainService::class,
|
2020-11-10 11:08:25 -06:00
|
|
|
],
|
2017-10-13 04:55:14 -05:00
|
|
|
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\UrlShortener::class => [
|
2021-02-05 10:59:34 -06:00
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class,
|
2020-10-25 05:16:42 -05:00
|
|
|
'em',
|
2020-11-07 02:31:46 -06:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
2022-09-23 11:46:51 -05:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class,
|
2022-07-24 04:07:20 -05:00
|
|
|
EventDispatcherInterface::class,
|
2020-10-25 05:16:42 -05:00
|
|
|
],
|
2021-02-08 12:50:17 -06:00
|
|
|
Visit\VisitsTracker::class => [
|
2020-05-08 06:10:58 -05:00
|
|
|
'em',
|
|
|
|
EventDispatcherInterface::class,
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\TrackingOptions::class,
|
2020-05-08 06:10:58 -05:00
|
|
|
],
|
2024-10-16 01:55:38 -05:00
|
|
|
Visit\RequestTracker::class => [Visit\VisitsTracker::class, Config\Options\TrackingOptions::class],
|
2023-05-18 02:01:57 -05:00
|
|
|
Visit\VisitsDeleter::class => [Visit\Repository\VisitDeleterRepository::class],
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\ShortUrlService::class => [
|
2021-01-31 05:12:21 -06:00
|
|
|
'em',
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-02-05 10:59:34 -06:00
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class,
|
2021-01-31 05:12:21 -06:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
2022-12-13 12:37:02 -06:00
|
|
|
],
|
|
|
|
ShortUrl\ShortUrlListService::class => [
|
|
|
|
ShortUrl\Repository\ShortUrlListRepository::class,
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\UrlShortenerOptions::class,
|
2021-01-31 05:12:21 -06:00
|
|
|
],
|
2024-04-12 11:29:55 -05:00
|
|
|
Visit\Geolocation\VisitLocator::class => ['em', Visit\Repository\VisitIterationRepository::class],
|
2022-09-23 07:50:26 -05:00
|
|
|
Visit\Geolocation\VisitToLocationHelper::class => [IpLocationResolverInterface::class],
|
2020-05-01 04:40:02 -05:00
|
|
|
Visit\VisitsStatsHelper::class => ['em'],
|
2024-11-09 02:25:01 -06:00
|
|
|
Tag\TagService::class => ['em', Tag\Repository\TagRepository::class],
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\DeleteShortUrlService::class => [
|
2020-02-01 15:54:02 -06:00
|
|
|
'em',
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\DeleteShortUrlsOptions::class,
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2024-04-03 11:57:09 -05:00
|
|
|
ShortUrl\Repository\ExpiredShortUrlsRepository::class,
|
2020-02-01 15:54:02 -06:00
|
|
|
],
|
2024-10-16 01:55:38 -05:00
|
|
|
ShortUrl\ShortUrlResolver::class => ['em', Config\Options\UrlShortenerOptions::class],
|
2023-05-14 05:00:08 -05:00
|
|
|
ShortUrl\ShortUrlVisitsDeleter::class => [
|
|
|
|
Visit\Repository\VisitDeleterRepository::class,
|
|
|
|
ShortUrl\ShortUrlResolver::class,
|
|
|
|
],
|
2024-10-16 01:55:38 -05:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class => ['em', Config\Options\UrlShortenerOptions::class],
|
2024-10-20 05:52:00 -05:00
|
|
|
Domain\DomainService::class => ['em', Config\Options\UrlShortenerOptions::class],
|
2017-07-22 06:48:30 -05:00
|
|
|
|
2020-10-25 07:20:34 -05:00
|
|
|
Util\DoctrineBatchHelper::class => ['em'],
|
2024-10-16 01:55:38 -05:00
|
|
|
Util\RedirectResponseHelper::class => [Config\Options\RedirectOptions::class],
|
2019-11-16 03:06:55 -06:00
|
|
|
|
2021-10-03 09:45:13 -05:00
|
|
|
Config\NotFoundRedirectResolver::class => [Util\RedirectResponseHelper::class, 'Logger_Shlink'],
|
2024-02-27 14:00:53 -06:00
|
|
|
|
|
|
|
RedirectRule\ShortUrlRedirectRuleService::class => ['em'],
|
|
|
|
RedirectRule\ShortUrlRedirectionResolver::class => [RedirectRule\ShortUrlRedirectRuleService::class],
|
2021-07-21 02:28:21 -05:00
|
|
|
|
2018-01-14 02:24:33 -06:00
|
|
|
Action\RedirectAction::class => [
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-07-15 10:23:09 -05:00
|
|
|
Visit\RequestTracker::class,
|
2021-07-15 06:28:31 -05:00
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class,
|
2020-11-10 11:08:25 -06:00
|
|
|
Util\RedirectResponseHelper::class,
|
2018-01-14 02:24:33 -06:00
|
|
|
],
|
2022-09-23 11:42:38 -05:00
|
|
|
Action\PixelAction::class => [ShortUrl\ShortUrlResolver::class, Visit\RequestTracker::class],
|
2020-01-26 12:21:51 -06:00
|
|
|
Action\QrCodeAction::class => [
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-02-01 15:55:52 -06:00
|
|
|
ShortUrl\Helper\ShortUrlStringifier::class,
|
2020-01-26 12:21:51 -06:00
|
|
|
'Logger_Shlink',
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\QrCodeOptions::class,
|
2020-01-26 12:21:51 -06:00
|
|
|
],
|
2024-10-16 01:55:38 -05:00
|
|
|
Action\RobotsAction::class => [Crawling\CrawlingHelper::class, Config\Options\RobotsOptions::class],
|
2018-12-01 14:38:29 -06:00
|
|
|
|
2023-05-21 11:08:17 -05:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class => [
|
|
|
|
'em',
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\UrlShortenerOptions::class,
|
2023-05-21 11:08:17 -05:00
|
|
|
Lock\LockFactory::class,
|
|
|
|
],
|
2024-10-20 05:52:00 -05:00
|
|
|
ShortUrl\Helper\ShortUrlStringifier::class => [
|
|
|
|
Config\Options\UrlShortenerOptions::class,
|
|
|
|
'config.router.base_path',
|
|
|
|
],
|
2024-10-16 01:55:38 -05:00
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class => [
|
|
|
|
'httpClient',
|
|
|
|
Config\Options\UrlShortenerOptions::class,
|
|
|
|
],
|
2024-02-24 16:10:08 -06:00
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class => [
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\TrackingOptions::class,
|
2024-02-24 16:10:08 -06:00
|
|
|
RedirectRule\ShortUrlRedirectionResolver::class,
|
|
|
|
],
|
2021-02-01 15:55:52 -06:00
|
|
|
ShortUrl\Transformer\ShortUrlDataTransformer::class => [ShortUrl\Helper\ShortUrlStringifier::class],
|
2021-07-15 09:54:54 -05:00
|
|
|
ShortUrl\Middleware\ExtraPathRedirectMiddleware::class => [
|
2022-09-23 11:42:38 -05:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-07-15 10:23:09 -05:00
|
|
|
Visit\RequestTracker::class,
|
2021-07-15 09:54:54 -05:00
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class,
|
|
|
|
Util\RedirectResponseHelper::class,
|
2024-10-16 01:55:38 -05:00
|
|
|
Config\Options\UrlShortenerOptions::class,
|
2021-07-15 09:54:54 -05:00
|
|
|
],
|
2024-10-16 01:55:38 -05:00
|
|
|
ShortUrl\Middleware\TrimTrailingSlashMiddleware::class => [Config\Options\UrlShortenerOptions::class],
|
2020-04-12 10:05:59 -05:00
|
|
|
|
2024-03-24 11:06:11 -05:00
|
|
|
EventDispatcher\PublishingUpdatesGenerator::class => [ShortUrl\Transformer\ShortUrlDataTransformer::class],
|
2020-10-22 11:12:22 -05:00
|
|
|
|
2020-10-25 05:16:42 -05:00
|
|
|
Importer\ImportedLinksProcessor::class => [
|
|
|
|
'em',
|
2020-11-07 02:31:46 -06:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
2022-09-23 11:46:51 -05:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class,
|
2020-10-25 07:20:34 -05:00
|
|
|
Util\DoctrineBatchHelper::class,
|
2020-10-25 05:16:42 -05:00
|
|
|
],
|
2021-05-22 02:34:42 -05:00
|
|
|
|
2023-02-10 13:26:18 -06:00
|
|
|
Crawling\CrawlingHelper::class => [ShortUrl\Repository\CrawlableShortCodesQuery::class],
|
2017-07-22 06:48:30 -05:00
|
|
|
],
|
|
|
|
|
2016-07-19 11:01:39 -05:00
|
|
|
];
|