From 4127e9ff7fc8a70cb0684350c96dc560d574cf0a Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Mon, 6 Nov 2017 13:58:56 -0500
Subject: [PATCH] Update factories for ServiceManager v3.

---
 module/VuFind/src/VuFind/Auth/Factory.php     |  18 +--
 .../src/VuFind/Autocomplete/Factory.php       |   8 +-
 .../src/VuFind/ChannelProvider/Factory.php    |  38 +++---
 .../src/VuFind/Config/PluginFactory.php       |  24 ++--
 .../VuFind/Content/AuthorNotes/Factory.php    |   2 +-
 .../src/VuFind/Content/Covers/Factory.php     |  10 +-
 .../src/VuFind/Content/Excerpts/Factory.php   |   2 +-
 module/VuFind/src/VuFind/Content/Factory.php  |  25 ++--
 .../src/VuFind/Content/Reviews/Factory.php    |  12 +-
 .../src/VuFind/Content/Summaries/Factory.php  |   2 +-
 .../VuFind/src/VuFind/Content/TOC/Factory.php |   2 +-
 .../VuFind/src/VuFind/Controller/Factory.php  |  30 ++---
 .../src/VuFind/Controller/GenericFactory.php  |   2 +-
 .../src/VuFind/Controller/Plugin/Factory.php  |  46 +++----
 module/VuFind/src/VuFind/Db/Row/Factory.php   |   8 +-
 module/VuFind/src/VuFind/Db/Table/Factory.php |  23 ++--
 .../Favorites/FavoritesServiceFactory.php     |  15 ++-
 .../src/VuFind/Hierarchy/Driver/Factory.php   |   4 +-
 .../Hierarchy/TreeDataSource/Factory.php      |  11 +-
 .../VuFind/Hierarchy/TreeRenderer/Factory.php |   2 +-
 .../VuFind/src/VuFind/ILS/Driver/Factory.php  |  58 ++++-----
 .../VuFind/src/VuFind/Log/LoggerFactory.php   |  45 +++----
 module/VuFind/src/VuFind/Mailer/Factory.php   |  15 ++-
 .../VuFind/src/VuFind/Recommend/Factory.php   |  58 ++++-----
 .../src/VuFind/RecordDriver/Factory.php       |  72 ++++++-----
 .../VuFind/src/VuFind/RecordTab/Factory.php   |  38 +++---
 module/VuFind/src/VuFind/Related/Factory.php  |  12 +-
 .../src/VuFind/Resolver/Driver/Factory.php    |  16 +--
 .../Role/DynamicRoleProviderFactory.php       |  36 +++---
 .../Role/PermissionProvider/Factory.php       |  16 +--
 module/VuFind/src/VuFind/SMS/Factory.php      |  15 ++-
 .../Factory/AbstractSolrBackendFactory.php    |  21 ++--
 .../Search/Factory/BrowZineBackendFactory.php |  21 ++--
 .../Search/Factory/EITBackendFactory.php      |  22 ++--
 .../Search/Factory/EdsBackendFactory.php      |  22 ++--
 .../Factory/LibGuidesBackendFactory.php       |  22 ++--
 .../Search/Factory/Pazpar2BackendFactory.php  |  22 ++--
 .../Search/Factory/PrimoBackendFactory.php    |  22 ++--
 .../Search/Factory/SummonBackendFactory.php   |  22 ++--
 .../Search/Factory/WorldCatBackendFactory.php |  22 ++--
 .../src/VuFind/Search/Options/Factory.php     |   6 +-
 .../VuFind/Search/Options/PluginFactory.php   |   4 +-
 .../src/VuFind/Search/Params/Factory.php      |   2 +-
 .../VuFind/Search/Params/PluginFactory.php    |   6 +-
 .../src/VuFind/Search/Results/Factory.php     |   7 +-
 .../VuFind/Search/Results/PluginFactory.php   |  10 +-
 .../ServiceManager/AbstractPluginFactory.php  |  38 +++---
 .../src/VuFind/Session/ManagerFactory.php     |  23 ++--
 .../VuFind/View/Helper/Bootstrap3/Factory.php |  12 +-
 .../src/VuFind/View/Helper/Root/Factory.php   | 112 +++++++++---------
 .../src/VuFindApi/Controller/Factory.php      |   6 +-
 .../src/VuFindTheme/View/Helper/Factory.php   |  12 +-
 52 files changed, 577 insertions(+), 522 deletions(-)

diff --git a/module/VuFind/src/VuFind/Auth/Factory.php b/module/VuFind/src/VuFind/Auth/Factory.php
index c5bd771b479..72c27463aaa 100644
--- a/module/VuFind/src/VuFind/Auth/Factory.php
+++ b/module/VuFind/src/VuFind/Auth/Factory.php
@@ -52,10 +52,10 @@ class Factory
     public static function getChoiceAuth(ServiceManager $sm)
     {
         $container = new \Zend\Session\Container(
-            'ChoiceAuth', $sm->getServiceLocator()->get('VuFind\SessionManager')
+            'ChoiceAuth', $sm->get('VuFind\SessionManager')
         );
         $auth = new ChoiceAuth($container);
-        $auth->setPluginManager($sm);
+        $auth->setPluginManager($sm->get('VuFind\AuthPluginManager'));
         return $auth;
     }
 
@@ -69,7 +69,7 @@ class Factory
     public static function getFacebook(ServiceManager $sm)
     {
         $container = new \Zend\Session\Container(
-            'Facebook', $sm->getServiceLocator()->get('VuFind\SessionManager')
+            'Facebook', $sm->get('VuFind\SessionManager')
         );
         return new Facebook($container);
     }
@@ -84,8 +84,8 @@ class Factory
     public static function getILS(ServiceManager $sm)
     {
         return new ILS(
-            $sm->getServiceLocator()->get('VuFind\ILSConnection'),
-            $sm->getServiceLocator()->get('VuFind\ILSAuthenticator')
+            $sm->get('VuFind\ILSConnection'),
+            $sm->get('VuFind\ILSAuthenticator')
         );
     }
 
@@ -166,7 +166,7 @@ class Factory
     public static function getMultiAuth(ServiceManager $sm)
     {
         $auth = new MultiAuth();
-        $auth->setPluginManager($sm);
+        $auth->setPluginManager($sm->get('VuFind\AuthPluginManager'));
         return $auth;
     }
 
@@ -180,8 +180,8 @@ class Factory
     public static function getMultiILS(ServiceManager $sm)
     {
         return new MultiILS(
-            $sm->getServiceLocator()->get('VuFind\ILSConnection'),
-            $sm->getServiceLocator()->get('VuFind\ILSAuthenticator')
+            $sm->get('VuFind\ILSConnection'),
+            $sm->get('VuFind\ILSAuthenticator')
         );
     }
 
@@ -195,7 +195,7 @@ class Factory
     public static function getShibboleth(ServiceManager $sm)
     {
         return new Shibboleth(
-            $sm->getServiceLocator()->get('VuFind\SessionManager')
+            $sm->get('VuFind\SessionManager')
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/Autocomplete/Factory.php b/module/VuFind/src/VuFind/Autocomplete/Factory.php
index 02e0d8cfb80..d5e9dade90f 100644
--- a/module/VuFind/src/VuFind/Autocomplete/Factory.php
+++ b/module/VuFind/src/VuFind/Autocomplete/Factory.php
@@ -52,7 +52,7 @@ class Factory
     public static function getSolr(ServiceManager $sm)
     {
         return new Solr(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -66,7 +66,7 @@ class Factory
     public static function getSolrAuth(ServiceManager $sm)
     {
         return new SolrAuth(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -80,7 +80,7 @@ class Factory
     public static function getSolrCN(ServiceManager $sm)
     {
         return new SolrCN(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -94,7 +94,7 @@ class Factory
     public static function getSolrReserves(ServiceManager $sm)
     {
         return new SolrReserves(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/ChannelProvider/Factory.php b/module/VuFind/src/VuFind/ChannelProvider/Factory.php
index a9c93670cee..788b4ad12e7 100644
--- a/module/VuFind/src/VuFind/ChannelProvider/Factory.php
+++ b/module/VuFind/src/VuFind/ChannelProvider/Factory.php
@@ -52,14 +52,14 @@ class Factory
     public static function getAlphaBrowse(ServiceManager $sm)
     {
         $helper = new AlphaBrowse(
-            $sm->getServiceLocator()->get('VuFind\Search'),
-            $sm->getServiceLocator()->get('VuFind\Search\BackendManager')
+            $sm->get('VuFind\Search'),
+            $sm->get('VuFind\Search\BackendManager')
                 ->get('Solr'),
-            $sm->getServiceLocator()->get('ControllerPluginManager')->get('url'),
-            $sm->getServiceLocator()->get('VuFind\RecordRouter')
+            $sm->get('ControllerPluginManager')->get('url'),
+            $sm->get('VuFind\RecordRouter')
         );
         $helper->setCoverRouter(
-            $sm->getServiceLocator()->get('VuFind\Cover\Router')
+            $sm->get('VuFind\Cover\Router')
         );
         return $helper;
     }
@@ -74,11 +74,11 @@ class Factory
     public static function getFacets(ServiceManager $sm)
     {
         $helper = new Facets(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'),
-            $sm->getServiceLocator()->get('ControllerPluginManager')->get('url')
+            $sm->get('VuFind\SearchResultsPluginManager'),
+            $sm->get('ControllerPluginManager')->get('url')
         );
         $helper->setCoverRouter(
-            $sm->getServiceLocator()->get('VuFind\Cover\Router')
+            $sm->get('VuFind\Cover\Router')
         );
         return $helper;
     }
@@ -93,13 +93,13 @@ class Factory
     public static function getListItems(ServiceManager $sm)
     {
         $helper = new ListItems(
-            $sm->getServiceLocator()->get('VuFind\DbTablePluginManager')
+            $sm->get('VuFind\DbTablePluginManager')
                 ->get('UserList'),
-            $sm->getServiceLocator()->get('ControllerPluginManager')->get('url'),
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('ControllerPluginManager')->get('url'),
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
         $helper->setCoverRouter(
-            $sm->getServiceLocator()->get('VuFind\Cover\Router')
+            $sm->get('VuFind\Cover\Router')
         );
         return $helper;
     }
@@ -114,11 +114,11 @@ class Factory
     public static function getRandom(ServiceManager $sm)
     {
         $helper = new Random(
-            $sm->getServiceLocator()->get('VuFind\Search'),
-            $sm->getServiceLocator()->get('VuFind\SearchParamsPluginManager')
+            $sm->get('VuFind\Search'),
+            $sm->get('VuFind\SearchParamsPluginManager')
         );
         $helper->setCoverRouter(
-            $sm->getServiceLocator()->get('VuFind\Cover\Router')
+            $sm->get('VuFind\Cover\Router')
         );
         return $helper;
     }
@@ -133,12 +133,12 @@ class Factory
     public static function getSimilarItems(ServiceManager $sm)
     {
         $helper = new SimilarItems(
-            $sm->getServiceLocator()->get('VuFind\Search'),
-            $sm->getServiceLocator()->get('ControllerPluginManager')->get('url'),
-            $sm->getServiceLocator()->get('VuFind\RecordRouter')
+            $sm->get('VuFind\Search'),
+            $sm->get('ControllerPluginManager')->get('url'),
+            $sm->get('VuFind\RecordRouter')
         );
         $helper->setCoverRouter(
-            $sm->getServiceLocator()->get('VuFind\Cover\Router')
+            $sm->get('VuFind\Cover\Router')
         );
         return $helper;
     }
diff --git a/module/VuFind/src/VuFind/Config/PluginFactory.php b/module/VuFind/src/VuFind/Config/PluginFactory.php
index 7d7f2a4f342..fd2dd8c4032 100644
--- a/module/VuFind/src/VuFind/Config/PluginFactory.php
+++ b/module/VuFind/src/VuFind/Config/PluginFactory.php
@@ -27,10 +27,10 @@
  */
 namespace VuFind\Config;
 
+use Interop\Container\ContainerInterface;
 use Zend\Config\Config;
 use Zend\Config\Reader\Ini as IniReader;
-use Zend\ServiceManager\AbstractFactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\AbstractFactoryInterface;
 
 /**
  * VuFind Config Plugin Factory
@@ -160,17 +160,15 @@ class PluginFactory implements AbstractFactoryInterface
     /**
      * Can we create a service for the specified name?
      *
-     * @param ServiceLocatorInterface $serviceLocator Service locator
-     * @param string                  $name           Name of service
-     * @param string                  $requestedName  Unfiltered name of service
+     * @param ContainerInterface $container     Service container
+     * @param string             $requestedName Name of service
      *
      * @return bool
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator,
-        $name, $requestedName
-    ) {
+    public function canCreate(ContainerInterface $container, $requestedName)
+    {
         // Assume that configurations exist:
         return true;
     }
@@ -178,16 +176,16 @@ class PluginFactory implements AbstractFactoryInterface
     /**
      * Create a service for the specified name.
      *
-     * @param ServiceLocatorInterface $serviceLocator Service locator
-     * @param string                  $name           Name of service
-     * @param string                  $requestedName  Unfiltered name of service
+     * @param ContainerInterface $container     Service container
+     * @param string             $requestedName Name of service
+     * @param array              $options       Options (unused)
      *
      * @return object
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createServiceWithName(ServiceLocatorInterface $serviceLocator,
-        $name, $requestedName
+    public function __invoke(ContainerInterface $container, $requestedName,
+        array $options = null
     ) {
         return $this->loadConfigFile($requestedName . '.ini');
     }
diff --git a/module/VuFind/src/VuFind/Content/AuthorNotes/Factory.php b/module/VuFind/src/VuFind/Content/AuthorNotes/Factory.php
index 11a9551c2ed..8c76af748ed 100644
--- a/module/VuFind/src/VuFind/Content/AuthorNotes/Factory.php
+++ b/module/VuFind/src/VuFind/Content/AuthorNotes/Factory.php
@@ -52,7 +52,7 @@ class Factory
      */
     public static function getAbstractSyndetics(ServiceManager $sm, $plus)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Syndetics(
             isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
             $plus,
diff --git a/module/VuFind/src/VuFind/Content/Covers/Factory.php b/module/VuFind/src/VuFind/Content/Covers/Factory.php
index 3fb6d89e633..4897d321def 100644
--- a/module/VuFind/src/VuFind/Content/Covers/Factory.php
+++ b/module/VuFind/src/VuFind/Content/Covers/Factory.php
@@ -51,7 +51,7 @@ class Factory
      */
     public static function getAmazon(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $associate = isset($config->Content->amazonassociate)
             ? $config->Content->amazonassociate : null;
         $secret = isset($config->Content->amazonsecret)
@@ -68,7 +68,7 @@ class Factory
      */
     public static function getBooksite(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $url = isset($config->Booksite->url)
             ? $config->Booksite->url : 'https://api.booksite.com';
         if (!isset($config->Booksite->key)) {
@@ -86,7 +86,7 @@ class Factory
      */
     public static function getBuchhandel(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $url = isset($config->Buchhandel->url)
             ? trim($config->Buchhandel->url, '/') . '/'
             : 'https://api.vlb.de/api/v1/cover/';
@@ -105,7 +105,7 @@ class Factory
      */
     public static function getContentCafe(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $finalConfig = isset($config->Contentcafe)
             ? $config->Contentcafe : new \Zend\Config\Config([]);
         return new ContentCafe($finalConfig);
@@ -120,7 +120,7 @@ class Factory
      */
     public static function getSyndetics(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Syndetics(
             isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl
         );
diff --git a/module/VuFind/src/VuFind/Content/Excerpts/Factory.php b/module/VuFind/src/VuFind/Content/Excerpts/Factory.php
index 15ba6dd967a..b931ca8360e 100644
--- a/module/VuFind/src/VuFind/Content/Excerpts/Factory.php
+++ b/module/VuFind/src/VuFind/Content/Excerpts/Factory.php
@@ -52,7 +52,7 @@ class Factory
      */
     public static function getAbstractSyndetics(ServiceManager $sm, $plus)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Syndetics(
             isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
             $plus,
diff --git a/module/VuFind/src/VuFind/Content/Factory.php b/module/VuFind/src/VuFind/Content/Factory.php
index 6c769de06a9..779adbcb225 100644
--- a/module/VuFind/src/VuFind/Content/Factory.php
+++ b/module/VuFind/src/VuFind/Content/Factory.php
@@ -51,9 +51,8 @@ class Factory
      */
     public static function getAuthorNotes(ServiceManager $sm)
     {
-        $loader = $sm->getServiceLocator()
-            ->get('VuFind\ContentAuthorNotesPluginManager');
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $loader = $sm->get('VuFind\ContentAuthorNotesPluginManager');
+        $config = $sm->get('VuFind\Config')->get('config');
         $providers = isset($config->Content->authorNotes)
             ? $config->Content->authorNotes : '';
         return new Loader($loader, $providers);
@@ -68,9 +67,8 @@ class Factory
      */
     public static function getExcerpts(ServiceManager $sm)
     {
-        $loader = $sm->getServiceLocator()
-            ->get('VuFind\ContentExcerptsPluginManager');
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $loader = $sm->get('VuFind\ContentExcerptsPluginManager');
+        $config = $sm->get('VuFind\Config')->get('config');
         $providers = isset($config->Content->excerpts)
             ? $config->Content->excerpts : '';
         return new Loader($loader, $providers);
@@ -85,9 +83,8 @@ class Factory
      */
     public static function getReviews(ServiceManager $sm)
     {
-        $loader = $sm->getServiceLocator()
-            ->get('VuFind\ContentReviewsPluginManager');
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $loader = $sm->get('VuFind\ContentReviewsPluginManager');
+        $config = $sm->get('VuFind\Config')->get('config');
         $providers = isset($config->Content->reviews)
             ? $config->Content->reviews : '';
         return new Loader($loader, $providers);
@@ -102,9 +99,8 @@ class Factory
      */
     public static function getSummaries(ServiceManager $sm)
     {
-        $loader = $sm->getServiceLocator()
-            ->get('VuFind\ContentSummariesPluginManager');
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $loader = $sm->get('VuFind\ContentSummariesPluginManager');
+        $config = $sm->get('VuFind\Config')->get('config');
         $providers = isset($config->Content->summaries)
             ? $config->Content->summaries : '';
         return new Loader($loader, $providers);
@@ -119,9 +115,8 @@ class Factory
      */
     public static function getTOC(ServiceManager $sm)
     {
-        $loader = $sm->getServiceLocator()
-            ->get('VuFind\ContentTOCPluginManager');
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $loader = $sm->get('VuFind\ContentTOCPluginManager');
+        $config = $sm->get('VuFind\Config')->get('config');
         $providers = isset($config->Content->toc)
             ? $config->Content->toc : '';
         return new Loader($loader, $providers);
diff --git a/module/VuFind/src/VuFind/Content/Reviews/Factory.php b/module/VuFind/src/VuFind/Content/Reviews/Factory.php
index 03e5aa6e105..5de2f2b5059 100644
--- a/module/VuFind/src/VuFind/Content/Reviews/Factory.php
+++ b/module/VuFind/src/VuFind/Content/Reviews/Factory.php
@@ -52,7 +52,7 @@ class Factory
      */
     public static function getAbstractSyndetics(ServiceManager $sm, $plus)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Syndetics(
             isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
             $plus,
@@ -69,12 +69,12 @@ class Factory
      */
     public static function getAmazon(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $associate = isset($config->Content->amazonassociate)
             ? $config->Content->amazonassociate : null;
         $secret = isset($config->Content->amazonsecret)
             ? $config->Content->amazonsecret : null;
-        $label = $sm->getServiceLocator()->get('VuFind\Translator')->translate(
+        $label = $sm->get('VuFind\Translator')->translate(
             'Supplied by Amazon'
         );
         return new Amazon($associate, $secret, $label);
@@ -89,12 +89,12 @@ class Factory
      */
     public static function getAmazonEditorial(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $associate = isset($config->Content->amazonassociate)
             ? $config->Content->amazonassociate : null;
         $secret = isset($config->Content->amazonsecret)
             ? $config->Content->amazonsecret : null;
-        $label = $sm->getServiceLocator()->get('VuFind\Translator')->translate(
+        $label = $sm->get('VuFind\Translator')->translate(
             'Supplied by Amazon'
         );
         return new AmazonEditorial($associate, $secret, $label);
@@ -109,7 +109,7 @@ class Factory
      */
     public static function getBooksite(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $url = isset($config->Booksite->url)
             ? $config->Booksite->url : 'https://api.booksite.com';
         if (!isset($config->Booksite->key)) {
diff --git a/module/VuFind/src/VuFind/Content/Summaries/Factory.php b/module/VuFind/src/VuFind/Content/Summaries/Factory.php
index b28f6b7d842..a4f45a2f188 100644
--- a/module/VuFind/src/VuFind/Content/Summaries/Factory.php
+++ b/module/VuFind/src/VuFind/Content/Summaries/Factory.php
@@ -52,7 +52,7 @@ class Factory
      */
     public static function getAbstractSyndetics(ServiceManager $sm, $plus)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Syndetics(
             isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
             $plus,
diff --git a/module/VuFind/src/VuFind/Content/TOC/Factory.php b/module/VuFind/src/VuFind/Content/TOC/Factory.php
index cfe89c2e324..66599895f2e 100644
--- a/module/VuFind/src/VuFind/Content/TOC/Factory.php
+++ b/module/VuFind/src/VuFind/Content/TOC/Factory.php
@@ -52,7 +52,7 @@ class Factory
      */
     public static function getAbstractSyndetics(ServiceManager $sm, $plus)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Syndetics(
             isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
             $plus,
diff --git a/module/VuFind/src/VuFind/Controller/Factory.php b/module/VuFind/src/VuFind/Controller/Factory.php
index f15bb99b039..2f7dd807610 100644
--- a/module/VuFind/src/VuFind/Controller/Factory.php
+++ b/module/VuFind/src/VuFind/Controller/Factory.php
@@ -52,8 +52,8 @@ class Factory extends GenericFactory
     public static function getBrowseController(ServiceManager $sm)
     {
         return new BrowseController(
-            $sm->getServiceLocator(),
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm,
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -67,10 +67,10 @@ class Factory extends GenericFactory
     public static function getCartController(ServiceManager $sm)
     {
         return new CartController(
-            $sm->getServiceLocator(),
+            $sm,
             new \Zend\Session\Container(
                 'cart_followup',
-                $sm->getServiceLocator()->get('VuFind\SessionManager')
+                $sm->get('VuFind\SessionManager')
             )
         );
     }
@@ -85,8 +85,8 @@ class Factory extends GenericFactory
     public static function getCollectionController(ServiceManager $sm)
     {
         return new CollectionController(
-            $sm->getServiceLocator(),
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm,
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -100,8 +100,8 @@ class Factory extends GenericFactory
     public static function getCollectionsController(ServiceManager $sm)
     {
         return new CollectionsController(
-            $sm->getServiceLocator(),
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm,
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -115,8 +115,8 @@ class Factory extends GenericFactory
     public static function getIndexController(ServiceManager $sm)
     {
         return new IndexController(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
-            $sm->getServiceLocator()->get('VuFind\AuthManager')
+            $sm->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\AuthManager')
         );
     }
 
@@ -130,8 +130,8 @@ class Factory extends GenericFactory
     public static function getRecordController(ServiceManager $sm)
     {
         return new RecordController(
-            $sm->getServiceLocator(),
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm,
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -145,10 +145,10 @@ class Factory extends GenericFactory
     public static function getUpgradeController(ServiceManager $sm)
     {
         return new UpgradeController(
-            $sm->getServiceLocator(),
-            $sm->getServiceLocator()->get('VuFind\CookieManager'),
+            $sm,
+            $sm->get('VuFind\CookieManager'),
             new \Zend\Session\Container(
-                'upgrade', $sm->getServiceLocator()->get('VuFind\SessionManager')
+                'upgrade', $sm->get('VuFind\SessionManager')
             )
         );
     }
diff --git a/module/VuFind/src/VuFind/Controller/GenericFactory.php b/module/VuFind/src/VuFind/Controller/GenericFactory.php
index 1a3141d5178..66e12fcb164 100644
--- a/module/VuFind/src/VuFind/Controller/GenericFactory.php
+++ b/module/VuFind/src/VuFind/Controller/GenericFactory.php
@@ -62,7 +62,7 @@ class GenericFactory
         if (!class_exists($class)) {
             throw new \Exception('Cannot construct ' . $class);
         }
-        return new $class($sm->getServiceLocator());
+        return new $class($sm);
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/Controller/Plugin/Factory.php b/module/VuFind/src/VuFind/Controller/Plugin/Factory.php
index 7fb3b2c2a5a..ca8009d9e04 100644
--- a/module/VuFind/src/VuFind/Controller/Plugin/Factory.php
+++ b/module/VuFind/src/VuFind/Controller/Plugin/Factory.php
@@ -52,9 +52,9 @@ class Factory
     public static function getFavorites(ServiceManager $sm)
     {
         return new Favorites(
-            $sm->getServiceLocator()->get('VuFind\RecordLoader'),
-            $sm->getServiceLocator()->get('VuFind\RecordCache'),
-            $sm->getServiceLocator()->get('VuFind\Tags')
+            $sm->get('VuFind\RecordLoader'),
+            $sm->get('VuFind\RecordCache'),
+            $sm->get('VuFind\Tags')
         );
     }
 
@@ -63,12 +63,12 @@ class Factory
      *
      * @param ServiceManager $sm Service manager.
      *
-     * @return \Zend\Mvc\Controller\Plugin\FlashMessenger
+     * @return \Zend\Mvc\Plugin\FlashMessenger\FlashMessenger
      */
     public static function getFlashMessenger(ServiceManager $sm)
     {
-        $plugin = new \Zend\Mvc\Controller\Plugin\FlashMessenger();
-        $sessionManager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+        $plugin = new \Zend\Mvc\Plugin\FlashMessenger\FlashMessenger();
+        $sessionManager = $sm->get('VuFind\SessionManager');
         $plugin->setSessionManager($sessionManager);
         return $plugin;
     }
@@ -84,7 +84,7 @@ class Factory
     {
         return new Followup(
             new \Zend\Session\Container(
-                'Followup', $sm->getServiceLocator()->get('VuFind\SessionManager')
+                'Followup', $sm->get('VuFind\SessionManager')
             )
         );
     }
@@ -99,8 +99,8 @@ class Factory
     public static function getHolds(ServiceManager $sm)
     {
         return new Holds(
-            $sm->getServiceLocator()->get('VuFind\HMAC'),
-            $sm->getServiceLocator()->get('VuFind\SessionManager')
+            $sm->get('VuFind\HMAC'),
+            $sm->get('VuFind\SessionManager')
         );
     }
 
@@ -114,8 +114,8 @@ class Factory
     public static function getILLRequests(ServiceManager $sm)
     {
         return new ILLRequests(
-            $sm->getServiceLocator()->get('VuFind\HMAC'),
-            $sm->getServiceLocator()->get('VuFind\SessionManager')
+            $sm->get('VuFind\HMAC'),
+            $sm->get('VuFind\SessionManager')
         );
     }
 
@@ -128,7 +128,7 @@ class Factory
      */
     public static function getNewItems(ServiceManager $sm)
     {
-        $search = $sm->getServiceLocator()->get('VuFind\Config')->get('searches');
+        $search = $sm->get('VuFind\Config')->get('searches');
         $config = isset($search->NewItem)
             ? $search->NewItem : new \Zend\Config\Config([]);
         return new NewItems($config);
@@ -143,9 +143,9 @@ class Factory
      */
     public static function getPermission(ServiceManager $sm)
     {
-        $pdm = $sm->getServiceLocator()->get('VuFind\Role\PermissionDeniedManager');
-        $pm = $sm->getServiceLocator()->get('VuFind\Role\PermissionManager');
-        $auth = $sm->getServiceLocator()->get('VuFind\AuthManager');
+        $pdm = $sm->get('VuFind\Role\PermissionDeniedManager');
+        $pm = $sm->get('VuFind\Role\PermissionManager');
+        $auth = $sm->get('VuFind\AuthManager');
         return new Permission($pm, $pdm, $auth);
     }
 
@@ -158,9 +158,9 @@ class Factory
      */
     public static function getRecaptcha(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Recaptcha(
-            $sm->getServiceLocator()->get('VuFind\Recaptcha'),
+            $sm->get('VuFind\Recaptcha'),
             $config
         );
     }
@@ -174,10 +174,10 @@ class Factory
      */
     public static function getReserves(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $useIndex = isset($config->Reserves->search_enabled)
             && $config->Reserves->search_enabled;
-        $ss = $useIndex ? $sm->getServiceLocator()->get('VuFind\Search') : null;
+        $ss = $useIndex ? $sm->get('VuFind\Search') : null;
         return new Reserves($useIndex, $ss);
     }
 
@@ -193,9 +193,9 @@ class Factory
         return new ResultScroller(
             new \Zend\Session\Container(
                 'ResultScroller',
-                $sm->getServiceLocator()->get('VuFind\SessionManager')
+                $sm->get('VuFind\SessionManager')
             ),
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -209,8 +209,8 @@ class Factory
     public static function getStorageRetrievalRequests(ServiceManager $sm)
     {
         return new StorageRetrievalRequests(
-            $sm->getServiceLocator()->get('VuFind\HMAC'),
-            $sm->getServiceLocator()->get('VuFind\SessionManager')
+            $sm->get('VuFind\HMAC'),
+            $sm->get('VuFind\SessionManager')
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/Db/Row/Factory.php b/module/VuFind/src/VuFind/Db/Row/Factory.php
index 1d40b917600..c3cdcd13f37 100644
--- a/module/VuFind/src/VuFind/Db/Row/Factory.php
+++ b/module/VuFind/src/VuFind/Db/Row/Factory.php
@@ -60,7 +60,7 @@ class Factory
         if (!class_exists($class)) {
             throw new \Exception('Cannot construct ' . $class);
         }
-        $adapter = $sm->getServiceLocator()->get('VuFind\DbAdapter');
+        $adapter = $sm->get('VuFind\DbAdapter');
         return new $class($adapter, ...$args);
     }
 
@@ -88,14 +88,14 @@ class Factory
      */
     public static function getUser(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $privacy = isset($config->Authentication->privacy)
             && $config->Authentication->privacy;
         $rowClass = $privacy ? 'PrivateUser' : 'User';
         $prototype = static::getGenericRow($rowClass, $sm);
         $prototype->setConfig($config);
         if ($privacy) {
-            $sessionManager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+            $sessionManager = $sm->get('VuFind\SessionManager');
             $session = new \Zend\Session\Container('Account', $sessionManager);
             $prototype->setSession($session);
         }
@@ -111,7 +111,7 @@ class Factory
      */
     public static function getUserList(ServiceManager $sm)
     {
-        $sessionManager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+        $sessionManager = $sm->get('VuFind\SessionManager');
         $session = new \Zend\Session\Container('List', $sessionManager);
         return static::getGenericRow('UserList', $sm, [$session]);
     }
diff --git a/module/VuFind/src/VuFind/Db/Table/Factory.php b/module/VuFind/src/VuFind/Db/Table/Factory.php
index ec20d7f0749..a9caa681702 100644
--- a/module/VuFind/src/VuFind/Db/Table/Factory.php
+++ b/module/VuFind/src/VuFind/Db/Table/Factory.php
@@ -53,7 +53,7 @@ class Factory
     public static function getRowPrototype(ServiceManager $sm, $name)
     {
         if ($name) {
-            $rowManager = $sm->getServiceLocator()->get('VuFind\DbRowPluginManager');
+            $rowManager = $sm->get('VuFind\DbRowPluginManager');
             return $rowManager->has($name) ? $rowManager->get($name) : null;
         }
         return null;
@@ -80,10 +80,11 @@ class Factory
         if (!class_exists($class)) {
             throw new \Exception('Cannot construct ' . $class);
         }
-        $adapter = $sm->getServiceLocator()->get('VuFind\DbAdapter');
-        $config = $sm->getServiceLocator()->get('config');
+        $adapter = $sm->get('VuFind\DbAdapter');
+        $config = $sm->get('config');
+        $tm = $sm->get('VuFind\DbTablePluginManager');
         return new $class(
-            $adapter, $sm, $config, static::getRowPrototype($sm, $rowName), ...$args
+            $adapter, $tm, $config, static::getRowPrototype($sm, $rowName), ...$args
         );
     }
 
@@ -114,8 +115,8 @@ class Factory
      */
     public static function getResource(ServiceManager $sm)
     {
-        $converter = $sm->getServiceLocator()->get('VuFind\DateConverter');
-        $loader = $sm->getServiceLocator()->get('VuFind\RecordLoader');
+        $converter = $sm->get('VuFind\DateConverter');
+        $loader = $sm->get('VuFind\RecordLoader');
         return static::getGenericTable(
             'Resource', $sm, 'resource', [$converter, $loader]
         );
@@ -130,7 +131,7 @@ class Factory
      */
     public static function getResourceTags(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $caseSensitive = isset($config->Social->case_sensitive_tags)
             && $config->Social->case_sensitive_tags;
         return static::getGenericTable(
@@ -147,7 +148,7 @@ class Factory
      */
     public static function getTags(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $caseSensitive = isset($config->Social->case_sensitive_tags)
             && $config->Social->case_sensitive_tags;
         return static::getGenericTable('Tags', $sm, 'tags', [$caseSensitive]);
@@ -162,12 +163,12 @@ class Factory
      */
     public static function getUser(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $privacy = isset($config->Authentication->privacy)
             && $config->Authentication->privacy;
         $session = null;
         if ($privacy) {
-            $sessionManager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+            $sessionManager = $sm->get('VuFind\SessionManager');
             $session = new \Zend\Session\Container('Account', $sessionManager);
         }
         return static::getGenericTable('User', $sm, 'user', [$config, $session]);
@@ -182,7 +183,7 @@ class Factory
      */
     public static function getUserList(ServiceManager $sm)
     {
-        $sessionManager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+        $sessionManager = $sm->get('VuFind\SessionManager');
         $session = new \Zend\Session\Container('List', $sessionManager);
         return static::getGenericTable('UserList', $sm, 'userlist', [$session]);
     }
diff --git a/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php b/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php
index ee1dfd1219f..5be7bb1104e 100644
--- a/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php
+++ b/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php
@@ -27,7 +27,8 @@
  */
 namespace VuFind\Favorites;
 
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Interop\Container\ContainerInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Favorites service
@@ -40,16 +41,20 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  *
  * @codeCoverageIgnore
  */
-class FavoritesServiceFactory implements \Zend\ServiceManager\FactoryInterface
+class FavoritesServiceFactory implements FactoryInterface
 {
     /**
      * Create service
      *
-     * @param ServiceLocatorInterface $sm Service manager
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @return mixed
+     * @return FavoritesService
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $sm)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
         $tableManager = $sm->get('VuFind\DbTablePluginManager');
         return new FavoritesService(
diff --git a/module/VuFind/src/VuFind/Hierarchy/Driver/Factory.php b/module/VuFind/src/VuFind/Hierarchy/Driver/Factory.php
index dba22dc12a6..945d9fad70d 100644
--- a/module/VuFind/src/VuFind/Hierarchy/Driver/Factory.php
+++ b/module/VuFind/src/VuFind/Hierarchy/Driver/Factory.php
@@ -85,7 +85,7 @@ class Factory
      */
     public static function getHierarchyDefault(ServiceManager $sm)
     {
-        return static::get($sm->getServiceLocator(), 'HierarchyDefault');
+        return static::get($sm, 'HierarchyDefault');
     }
 
     /**
@@ -97,6 +97,6 @@ class Factory
      */
     public static function getHierarchyFlat(ServiceManager $sm)
     {
-        return static::get($sm->getServiceLocator(), 'HierarchyFlat');
+        return static::get($sm, 'HierarchyFlat');
     }
 }
diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Factory.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Factory.php
index 9d635ebf02e..9e5cd34766c 100644
--- a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Factory.php
+++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Factory.php
@@ -53,20 +53,19 @@ class Factory
      */
     public static function getSolr(ServiceManager $sm)
     {
-        $cacheDir = $sm->getServiceLocator()->get('VuFind\CacheManager')
+        $cacheDir = $sm->get('VuFind\CacheManager')
             ->getCacheDir(false);
-        $hierarchyFilters = $sm->getServiceLocator()->get('VuFind\Config')
+        $hierarchyFilters = $sm->get('VuFind\Config')
             ->get('HierarchyDefault');
         $filters = isset($hierarchyFilters->HierarchyTree->filterQueries)
           ? $hierarchyFilters->HierarchyTree->filterQueries->toArray()
           : [];
-        $config = $sm->getServiceLocator()->get('VuFind\Config')
-            ->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $batchSize = isset($config->Index->cursor_batch_size)
             ? $config->Index->cursor_batch_size : 1000;
-        $solr = $sm->getServiceLocator()->get('VuFind\Search\BackendManager')
+        $solr = $sm->get('VuFind\Search\BackendManager')
             ->get('Solr')->getConnector();
-        $formatterManager = $sm->getServiceLocator()
+        $formatterManager = $sm
             ->get('VuFind\HierarchyTreeDataFormatterPluginManager');
         return new Solr(
             $solr, $formatterManager, rtrim($cacheDir, '/') . '/hierarchy',
diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/Factory.php b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/Factory.php
index 8f094dbfd39..b4d77c2569c 100644
--- a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/Factory.php
+++ b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/Factory.php
@@ -54,7 +54,7 @@ class Factory
     public static function getJSTree(ServiceManager $sm)
     {
         return new JSTree(
-            $sm->getServiceLocator()->get('ControllerPluginManager')->get('Url')
+            $sm->get('ControllerPluginManager')->get('Url')
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Factory.php b/module/VuFind/src/VuFind/ILS/Driver/Factory.php
index 1baae161a0a..c686b5f2aa2 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Factory.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Factory.php
@@ -52,8 +52,8 @@ class Factory
     public static function getAleph(ServiceManager $sm)
     {
         return new Aleph(
-            $sm->getServiceLocator()->get('VuFind\DateConverter'),
-            $sm->getServiceLocator()->get('VuFind\CacheManager')
+            $sm->get('VuFind\DateConverter'),
+            $sm->get('VuFind\CacheManager')
         );
     }
 
@@ -67,11 +67,11 @@ class Factory
     public static function getDAIA(ServiceManager $sm)
     {
         $daia = new DAIA(
-            $sm->getServiceLocator()->get('VuFind\DateConverter')
+            $sm->get('VuFind\DateConverter')
         );
 
         $daia->setCacheStorage(
-            $sm->getServiceLocator()->get('VuFind\CacheManager')->getCache('object')
+            $sm->get('VuFind\CacheManager')->getCache('object')
         );
 
         return $daia;
@@ -87,7 +87,7 @@ class Factory
     public static function getLBS4(ServiceManager $sm)
     {
         return new LBS4(
-            $sm->getServiceLocator()->get('VuFind\DateConverter')
+            $sm->get('VuFind\DateConverter')
         );
     }
 
@@ -101,12 +101,12 @@ class Factory
     public static function getDemo(ServiceManager $sm)
     {
         $sessionFactory = function () use ($sm) {
-            $manager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+            $manager = $sm->get('VuFind\SessionManager');
             return new \Zend\Session\Container('DemoDriver', $manager);
         };
         return new Demo(
-            $sm->getServiceLocator()->get('VuFind\DateConverter'),
-            $sm->getServiceLocator()->get('VuFind\Search'), $sessionFactory
+            $sm->get('VuFind\DateConverter'),
+            $sm->get('VuFind\Search'), $sessionFactory
         );
     }
 
@@ -119,7 +119,7 @@ class Factory
      */
     public static function getHorizon(ServiceManager $sm)
     {
-        return new Horizon($sm->getServiceLocator()->get('VuFind\DateConverter'));
+        return new Horizon($sm->get('VuFind\DateConverter'));
     }
 
     /**
@@ -132,7 +132,7 @@ class Factory
     public static function getHorizonXMLAPI(ServiceManager $sm)
     {
         return new HorizonXMLAPI(
-            $sm->getServiceLocator()->get('VuFind\DateConverter')
+            $sm->get('VuFind\DateConverter')
         );
     }
 
@@ -146,8 +146,8 @@ class Factory
     public static function getMultiBackend(ServiceManager $sm)
     {
         return new MultiBackend(
-            $sm->getServiceLocator()->get('VuFind\Config'),
-            $sm->getServiceLocator()->get('VuFind\ILSAuthenticator'),
+            $sm->get('VuFind\Config'),
+            $sm->get('VuFind\ILSAuthenticator'),
             $sm
         );
     }
@@ -161,7 +161,7 @@ class Factory
      */
     public static function getNoILS(ServiceManager $sm)
     {
-        return new NoILS($sm->getServiceLocator()->get('VuFind\RecordLoader'));
+        return new NoILS($sm->get('VuFind\RecordLoader'));
     }
 
     /**
@@ -174,12 +174,12 @@ class Factory
     public static function getPAIA(ServiceManager $sm)
     {
         $paia = new PAIA(
-            $sm->getServiceLocator()->get('VuFind\DateConverter'),
-            $sm->getServiceLocator()->get('VuFind\SessionManager')
+            $sm->get('VuFind\DateConverter'),
+            $sm->get('VuFind\SessionManager')
         );
 
         $paia->setCacheStorage(
-            $sm->getServiceLocator()->get('VuFind\CacheManager')->getCache('object')
+            $sm->get('VuFind\CacheManager')->getCache('object')
         );
 
         return $paia;
@@ -194,7 +194,7 @@ class Factory
      */
     public static function getKoha(ServiceManager $sm)
     {
-        return new Koha($sm->getServiceLocator()->get('VuFind\DateConverter'));
+        return new Koha($sm->get('VuFind\DateConverter'));
     }
 
     /**
@@ -206,9 +206,9 @@ class Factory
      */
     public static function getKohaILSDI(ServiceManager $sm)
     {
-        $koha = new KohaILSDI($sm->getServiceLocator()->get('VuFind\DateConverter'));
+        $koha = new KohaILSDI($sm->get('VuFind\DateConverter'));
         $koha->setCacheStorage(
-            $sm->getServiceLocator()->get('VuFind\CacheManager')->getCache('object')
+            $sm->get('VuFind\CacheManager')->getCache('object')
         );
         return $koha;
     }
@@ -223,16 +223,16 @@ class Factory
     public static function getSierraRest(ServiceManager $sm)
     {
         $sessionFactory = function ($namespace) use ($sm) {
-            $manager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+            $manager = $sm->get('VuFind\SessionManager');
             return new \Zend\Session\Container("SierraRest_$namespace", $manager);
         };
 
         $driver = new SierraRest(
-            $sm->getServiceLocator()->get('VuFind\DateConverter'),
+            $sm->get('VuFind\DateConverter'),
             $sessionFactory
         );
         $driver->setCacheStorage(
-            $sm->getServiceLocator()->get('VuFind\CacheManager')->getCache('object')
+            $sm->get('VuFind\CacheManager')->getCache('object')
         );
         return $driver;
     }
@@ -247,8 +247,8 @@ class Factory
     public static function getSymphony(ServiceManager $sm)
     {
         return new Symphony(
-            $sm->getServiceLocator()->get('VuFind\RecordLoader'),
-            $sm->getServiceLocator()->get('VuFind\CacheManager')
+            $sm->get('VuFind\RecordLoader'),
+            $sm->get('VuFind\CacheManager')
         );
     }
 
@@ -261,7 +261,7 @@ class Factory
      */
     public static function getUnicorn(ServiceManager $sm)
     {
-        return new Unicorn($sm->getServiceLocator()->get('VuFind\DateConverter'));
+        return new Unicorn($sm->get('VuFind\DateConverter'));
     }
 
     /**
@@ -273,7 +273,7 @@ class Factory
      */
     public static function getVoyager(ServiceManager $sm)
     {
-        return new Voyager($sm->getServiceLocator()->get('VuFind\DateConverter'));
+        return new Voyager($sm->get('VuFind\DateConverter'));
     }
 
     /**
@@ -285,13 +285,13 @@ class Factory
      */
     public static function getVoyagerRestful(ServiceManager $sm)
     {
-        $ils = $sm->getServiceLocator()->get('VuFind\ILSHoldSettings');
+        $ils = $sm->get('VuFind\ILSHoldSettings');
         $vr = new VoyagerRestful(
-            $sm->getServiceLocator()->get('VuFind\DateConverter'),
+            $sm->get('VuFind\DateConverter'),
             $ils->getHoldsMode(), $ils->getTitleHoldsMode()
         );
         $vr->setCacheStorage(
-            $sm->getServiceLocator()->get('VuFind\CacheManager')->getCache('object')
+            $sm->get('VuFind\CacheManager')->getCache('object')
         );
         return $vr;
     }
diff --git a/module/VuFind/src/VuFind/Log/LoggerFactory.php b/module/VuFind/src/VuFind/Log/LoggerFactory.php
index 7a2cfd41f0e..9f42f60f727 100644
--- a/module/VuFind/src/VuFind/Log/LoggerFactory.php
+++ b/module/VuFind/src/VuFind/Log/LoggerFactory.php
@@ -27,9 +27,10 @@
  */
 namespace VuFind\Log;
 
+use Interop\Container\ContainerInterface;
 use Zend\Config\Config;
 use Zend\Log\Writer\WriterInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for instantiating Logger
@@ -42,18 +43,18 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  *
  * @codeCoverageIgnore
  */
-class LoggerFactory implements \Zend\ServiceManager\FactoryInterface
+class LoggerFactory implements FactoryInterface
 {
     /**
      * Configure database writers.
      *
-     * @param Logger                  $logger Logger object
-     * @param ServiceLocatorInterface $sm     Service locator
-     * @param string                  $config Configuration
+     * @param Logger             $logger Logger object
+     * @param ContainerInterface $sm     Service locator
+     * @param string             $config Configuration
      *
      * @return void
      */
-    protected function addDbWriters(Logger $logger, ServiceLocatorInterface $sm,
+    protected function addDbWriters(Logger $logger, ContainerInterface $sm,
         $config
     ) {
         $parts = explode(':', $config);
@@ -79,13 +80,13 @@ class LoggerFactory implements \Zend\ServiceManager\FactoryInterface
     /**
      * Configure email writers.
      *
-     * @param Logger                  $logger Logger object
-     * @param ServiceLocatorInterface $sm     Service locator
-     * @param Config                  $config Configuration
+     * @param Logger             $logger Logger object
+     * @param ContainerInterface $sm     Service locator
+     * @param Config             $config Configuration
      *
      * @return void
      */
-    protected function addEmailWriters(Logger $logger, ServiceLocatorInterface $sm,
+    protected function addEmailWriters(Logger $logger, ContainerInterface $sm,
         Config $config
     ) {
         // Set up the logger's mailer to behave consistently with VuFind's
@@ -130,13 +131,13 @@ class LoggerFactory implements \Zend\ServiceManager\FactoryInterface
     /**
      * Configure Slack writers.
      *
-     * @param Logger                  $logger Logger object
-     * @param ServiceLocatorInterface $sm     Service locator
-     * @param Config                  $config Configuration
+     * @param Logger             $logger Logger object
+     * @param ContainerInterface $sm     Service locator
+     * @param Config             $config Configuration
      *
      * @return void
      */
-    protected function addSlackWriters(Logger $logger, ServiceLocatorInterface $sm,
+    protected function addSlackWriters(Logger $logger, ContainerInterface $sm,
         Config $config
     ) {
         $options = [];
@@ -170,12 +171,12 @@ class LoggerFactory implements \Zend\ServiceManager\FactoryInterface
     /**
      * Set configuration
      *
-     * @param ServiceLocatorInterface $sm     Service manager
-     * @param Logger                  $logger Logger to configure
+     * @param ContainerInterface $sm     Service manager
+     * @param Logger             $logger Logger to configure
      *
      * @return void
      */
-    protected function configureLogger(ServiceLocatorInterface $sm, Logger $logger)
+    protected function configureLogger(ContainerInterface $sm, Logger $logger)
     {
         $config = $sm->get('VuFind\Config')->get('config');
 
@@ -324,11 +325,15 @@ class LoggerFactory implements \Zend\ServiceManager\FactoryInterface
     /**
      * Create service
      *
-     * @param ServiceLocatorInterface $sm Service manager
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @return mixed
+     * @return Logger
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $sm)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
         $logger = new Logger();
         $this->configureLogger($sm, $logger);
diff --git a/module/VuFind/src/VuFind/Mailer/Factory.php b/module/VuFind/src/VuFind/Mailer/Factory.php
index 711755910e1..064cfc80187 100644
--- a/module/VuFind/src/VuFind/Mailer/Factory.php
+++ b/module/VuFind/src/VuFind/Mailer/Factory.php
@@ -27,10 +27,11 @@
  */
 namespace VuFind\Mailer;
 
+use Interop\Container\ContainerInterface;
 use Zend\Mail\Transport\InMemory;
 use Zend\Mail\Transport\Smtp;
 use Zend\Mail\Transport\SmtpOptions;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for instantiating Mailer objects
@@ -43,7 +44,7 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  *
  * @codeCoverageIgnore
  */
-class Factory implements \Zend\ServiceManager\FactoryInterface
+class Factory implements FactoryInterface
 {
     /**
      * Build the mail transport object.
@@ -87,11 +88,15 @@ class Factory implements \Zend\ServiceManager\FactoryInterface
     /**
      * Create service
      *
-     * @param ServiceLocatorInterface $sm Service manager
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @return mixed
+     * @return \VuFind\Mailer\Mailer
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $sm)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
         // Load configurations:
         $config = $sm->get('VuFind\Config')->get('config');
diff --git a/module/VuFind/src/VuFind/Recommend/Factory.php b/module/VuFind/src/VuFind/Recommend/Factory.php
index f7d960c269a..323db074331 100644
--- a/module/VuFind/src/VuFind/Recommend/Factory.php
+++ b/module/VuFind/src/VuFind/Recommend/Factory.php
@@ -52,7 +52,7 @@ class Factory
     public static function getAuthorFacets(ServiceManager $sm)
     {
         return new AuthorFacets(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -65,10 +65,10 @@ class Factory
      */
     public static function getAuthorInfo(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new AuthorInfo(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'),
-            $sm->getServiceLocator()->get('VuFind\Http')->createClient(),
+            $sm->get('VuFind\SearchResultsPluginManager'),
+            $sm->get('VuFind\Http')->createClient(),
             isset($config->Content->authors) ? $config->Content->authors : ''
         );
     }
@@ -83,7 +83,7 @@ class Factory
     public static function getAuthorityRecommend(ServiceManager $sm)
     {
         return new AuthorityRecommend(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -97,7 +97,7 @@ class Factory
     public static function getCatalogResults(ServiceManager $sm)
     {
         return new CatalogResults(
-            $sm->getServiceLocator()->get('VuFind\SearchRunner')
+            $sm->get('VuFind\SearchRunner')
         );
     }
 
@@ -111,8 +111,8 @@ class Factory
     public static function getCollectionSideFacets(ServiceManager $sm)
     {
         return new CollectionSideFacets(
-            $sm->getServiceLocator()->get('VuFind\Config'),
-            $sm->getServiceLocator()->get('VuFind\HierarchicalFacetHelper')
+            $sm->get('VuFind\Config'),
+            $sm->get('VuFind\HierarchicalFacetHelper')
         );
     }
 
@@ -125,13 +125,13 @@ class Factory
      */
     public static function getDPLATerms(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         if (!isset($config->DPLA->apiKey)) {
             throw new \Exception('DPLA API key missing from configuration.');
         }
         return new DPLATerms(
             $config->DPLA->apiKey,
-            $sm->getServiceLocator()->get('VuFind\Http')->createClient()
+            $sm->get('VuFind\Http')->createClient()
         );
     }
 
@@ -144,7 +144,7 @@ class Factory
      */
     public static function getEuropeanaResults(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new EuropeanaResults(
             $config->Content->europeanaAPI
         );
@@ -160,8 +160,8 @@ class Factory
     public static function getExpandFacets(ServiceManager $sm)
     {
         return new ExpandFacets(
-            $sm->getServiceLocator()->get('VuFind\Config'),
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\Config'),
+            $sm->get('VuFind\SearchResultsPluginManager')
                 ->get('Solr')
         );
     }
@@ -175,7 +175,7 @@ class Factory
      */
     public static function getFavoriteFacets(ServiceManager $sm)
     {
-        $parentSm = $sm->getServiceLocator();
+        $parentSm = $sm;
         return new FavoriteFacets(
             $parentSm->get('VuFind\Config'),
             null,
@@ -192,8 +192,8 @@ class Factory
      */
     public function getMapSelection(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('Vufind\Config');
-        $backend = $sm->getServiceLocator()->get('VuFind\Search\BackendManager');
+        $config = $sm->get('Vufind\Config');
+        $backend = $sm->get('VuFind\Search\BackendManager');
         $solr = $backend->get('Solr');
         return new MapSelection($config, $solr);
     }
@@ -208,8 +208,8 @@ class Factory
     public static function getRandomRecommend(ServiceManager $sm)
     {
         return new RandomRecommend(
-            $sm->getServiceLocator()->get('VuFind\Search'),
-            $sm->getServiceLocator()->get('VuFind\SearchParamsPluginManager')
+            $sm->get('VuFind\Search'),
+            $sm->get('VuFind\SearchParamsPluginManager')
         );
     }
 
@@ -223,8 +223,8 @@ class Factory
     public static function getSideFacets(ServiceManager $sm)
     {
         return new SideFacets(
-            $sm->getServiceLocator()->get('VuFind\Config'),
-            $sm->getServiceLocator()->get('VuFind\HierarchicalFacetHelper')
+            $sm->get('VuFind\Config'),
+            $sm->get('VuFind\HierarchicalFacetHelper')
         );
     }
 
@@ -238,7 +238,7 @@ class Factory
     public static function getSummonBestBets(ServiceManager $sm)
     {
         return new SummonBestBets(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -252,7 +252,7 @@ class Factory
     public static function getSummonDatabases(ServiceManager $sm)
     {
         return new SummonDatabases(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -266,7 +266,7 @@ class Factory
     public static function getSummonResults(ServiceManager $sm)
     {
         return new SummonResults(
-            $sm->getServiceLocator()->get('VuFind\SearchRunner')
+            $sm->get('VuFind\SearchRunner')
         );
     }
 
@@ -280,7 +280,7 @@ class Factory
     public static function getSummonTopics(ServiceManager $sm)
     {
         return new SummonTopics(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager')
+            $sm->get('VuFind\SearchResultsPluginManager')
         );
     }
 
@@ -294,7 +294,7 @@ class Factory
     public static function getSwitchQuery(ServiceManager $sm)
     {
         return new SwitchQuery(
-            $sm->getServiceLocator()->get('VuFind\Search\BackendManager')
+            $sm->get('VuFind\Search\BackendManager')
         );
     }
 
@@ -308,7 +308,7 @@ class Factory
     public static function getTopFacets(ServiceManager $sm)
     {
         return new TopFacets(
-            $sm->getServiceLocator()->get('VuFind\Config')
+            $sm->get('VuFind\Config')
         );
     }
 
@@ -322,7 +322,7 @@ class Factory
     public static function getVisualFacets(ServiceManager $sm)
     {
         return new VisualFacets(
-            $sm->getServiceLocator()->get('VuFind\Config')
+            $sm->get('VuFind\Config')
         );
     }
 
@@ -335,7 +335,7 @@ class Factory
      */
     public static function getWebResults(ServiceManager $sm)
     {
-        return new WebResults($sm->getServiceLocator()->get('VuFind\SearchRunner'));
+        return new WebResults($sm->get('VuFind\SearchRunner'));
     }
 
     /**
@@ -348,7 +348,7 @@ class Factory
     public static function getWorldCatIdentities(ServiceManager $sm)
     {
         return new WorldCatIdentities(
-            $sm->getServiceLocator()->get('VuFind\WorldCatUtils')
+            $sm->get('VuFind\WorldCatUtils')
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/RecordDriver/Factory.php b/module/VuFind/src/VuFind/RecordDriver/Factory.php
index 7a1b15bf2fe..add258a8186 100644
--- a/module/VuFind/src/VuFind/RecordDriver/Factory.php
+++ b/module/VuFind/src/VuFind/RecordDriver/Factory.php
@@ -51,10 +51,8 @@ class Factory
      */
     public static function getEDS(ServiceManager $sm)
     {
-        $eds = $sm->getServiceLocator()->get('VuFind\Config')->get('EDS');
-        return new EDS(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'), $eds, $eds
-        );
+        $eds = $sm->get('VuFind\Config')->get('EDS');
+        return new EDS($sm->get('VuFind\Config')->get('config'), $eds, $eds);
     }
 
     /**
@@ -66,9 +64,9 @@ class Factory
      */
     public static function getEIT(ServiceManager $sm)
     {
-        $eit = $sm->getServiceLocator()->get('VuFind\Config')->get('EIT');
+        $eit = $sm->get('VuFind\Config')->get('EIT');
         return new EIT(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'), $eit, $eit
+            $sm->get('VuFind\Config')->get('config'), $eit, $eit
         );
     }
 
@@ -82,7 +80,7 @@ class Factory
     public static function getMissing(ServiceManager $sm)
     {
         return new Missing(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -95,9 +93,9 @@ class Factory
      */
     public static function getPazpar2(ServiceManager $sm)
     {
-        $pp2 = $sm->getServiceLocator()->get('VuFind\Config')->get('Pazpar2');
+        $pp2 = $sm->get('VuFind\Config')->get('Pazpar2');
         return new Pazpar2(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'), $pp2, $pp2
+            $sm->get('VuFind\Config')->get('config'), $pp2, $pp2
         );
     }
 
@@ -110,9 +108,9 @@ class Factory
      */
     public static function getPrimo(ServiceManager $sm)
     {
-        $primo = $sm->getServiceLocator()->get('VuFind\Config')->get('Primo');
+        $primo = $sm->get('VuFind\Config')->get('Primo');
         $driver = new Primo(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\Config')->get('config'),
             $primo, $primo
         );
         return $driver;
@@ -128,9 +126,9 @@ class Factory
     public static function getSolrAuth(ServiceManager $sm)
     {
         return new SolrAuth(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\Config')->get('config'),
             null,
-            $sm->getServiceLocator()->get('VuFind\Config')->get('searches')
+            $sm->get('VuFind\Config')->get('searches')
         );
     }
 
@@ -144,11 +142,11 @@ class Factory
     public static function getSolrDefault(ServiceManager $sm)
     {
         $driver = new SolrDefault(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\Config')->get('config'),
             null,
-            $sm->getServiceLocator()->get('VuFind\Config')->get('searches')
+            $sm->get('VuFind\Config')->get('searches')
         );
-        $driver->attachSearchService($sm->getServiceLocator()->get('VuFind\Search'));
+        $driver->attachSearchService($sm->get('VuFind\Search'));
         return $driver;
     }
 
@@ -162,16 +160,16 @@ class Factory
     public static function getSolrMarc(ServiceManager $sm)
     {
         $driver = new SolrMarc(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\Config')->get('config'),
             null,
-            $sm->getServiceLocator()->get('VuFind\Config')->get('searches')
+            $sm->get('VuFind\Config')->get('searches')
         );
         $driver->attachILS(
-            $sm->getServiceLocator()->get('VuFind\ILSConnection'),
-            $sm->getServiceLocator()->get('VuFind\ILSHoldLogic'),
-            $sm->getServiceLocator()->get('VuFind\ILSTitleHoldLogic')
+            $sm->get('VuFind\ILSConnection'),
+            $sm->get('VuFind\ILSHoldLogic'),
+            $sm->get('VuFind\ILSTitleHoldLogic')
         );
-        $driver->attachSearchService($sm->getServiceLocator()->get('VuFind\Search'));
+        $driver->attachSearchService($sm->get('VuFind\Search'));
         return $driver;
     }
 
@@ -185,16 +183,16 @@ class Factory
     public static function getSolrMarcRemote(ServiceManager $sm)
     {
         $driver = new SolrMarcRemote(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\Config')->get('config'),
             null,
-            $sm->getServiceLocator()->get('VuFind\Config')->get('searches')
+            $sm->get('VuFind\Config')->get('searches')
         );
         $driver->attachILS(
-            $sm->getServiceLocator()->get('VuFind\ILSConnection'),
-            $sm->getServiceLocator()->get('VuFind\ILSHoldLogic'),
-            $sm->getServiceLocator()->get('VuFind\ILSTitleHoldLogic')
+            $sm->get('VuFind\ILSConnection'),
+            $sm->get('VuFind\ILSHoldLogic'),
+            $sm->get('VuFind\ILSTitleHoldLogic')
         );
-        $driver->attachSearchService($sm->getServiceLocator()->get('VuFind\Search'));
+        $driver->attachSearchService($sm->get('VuFind\Search'));
         return $driver;
     }
 
@@ -208,9 +206,9 @@ class Factory
     public static function getSolrReserves(ServiceManager $sm)
     {
         return new SolrReserves(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\Config')->get('config'),
             null,
-            $sm->getServiceLocator()->get('VuFind\Config')->get('searches')
+            $sm->get('VuFind\Config')->get('searches')
         );
     }
 
@@ -223,9 +221,9 @@ class Factory
      */
     public static function getSolrWeb(ServiceManager $sm)
     {
-        $web = $sm->getServiceLocator()->get('VuFind\Config')->get('website');
+        $web = $sm->get('VuFind\Config')->get('website');
         return new SolrWeb(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'), $web, $web
+            $sm->get('VuFind\Config')->get('config'), $web, $web
         );
     }
 
@@ -238,13 +236,13 @@ class Factory
      */
     public static function getSummon(ServiceManager $sm)
     {
-        $summon = $sm->getServiceLocator()->get('VuFind\Config')->get('Summon');
+        $summon = $sm->get('VuFind\Config')->get('Summon');
         $driver = new Summon(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\Config')->get('config'),
             $summon, $summon
         );
         $driver->setDateConverter(
-            $sm->getServiceLocator()->get('VuFind\DateConverter')
+            $sm->get('VuFind\DateConverter')
         );
         return $driver;
     }
@@ -258,9 +256,9 @@ class Factory
      */
     public static function getWorldCat(ServiceManager $sm)
     {
-        $wc = $sm->getServiceLocator()->get('VuFind\Config')->get('WorldCat');
+        $wc = $sm->get('VuFind\Config')->get('WorldCat');
         return new WorldCat(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'), $wc, $wc
+            $sm->get('VuFind\Config')->get('config'), $wc, $wc
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/RecordTab/Factory.php b/module/VuFind/src/VuFind/RecordTab/Factory.php
index fa63b618735..c14a77b9eb8 100644
--- a/module/VuFind/src/VuFind/RecordTab/Factory.php
+++ b/module/VuFind/src/VuFind/RecordTab/Factory.php
@@ -52,8 +52,8 @@ class Factory
     public static function getCollectionHierarchyTree(ServiceManager $sm)
     {
         return new CollectionHierarchyTree(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
-            $sm->getServiceLocator()->get('VuFind\RecordLoader')
+            $sm->get('VuFind\Config')->get('config'),
+            $sm->get('VuFind\RecordLoader')
         );
     }
 
@@ -67,8 +67,8 @@ class Factory
     public static function getCollectionList(ServiceManager $sm)
     {
         return new CollectionList(
-            $sm->getServiceLocator()->get('VuFind\SearchRunner'),
-            $sm->getServiceLocator()->get('VuFind\RecommendPluginManager')
+            $sm->get('VuFind\SearchRunner'),
+            $sm->get('VuFind\RecommendPluginManager')
         );
     }
 
@@ -81,10 +81,10 @@ class Factory
      */
     public static function getExcerpt(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         // Only instantiate the loader if the feature is enabled:
         if (isset($config->Content->excerpts)) {
-            $loader = $sm->getServiceLocator()->get('VuFind\ContentPluginManager')
+            $loader = $sm->get('VuFind\ContentPluginManager')
                 ->get('excerpts');
         } else {
             $loader = null;
@@ -128,7 +128,7 @@ class Factory
     public static function getHierarchyTree(ServiceManager $sm)
     {
         return new HierarchyTree(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -144,11 +144,11 @@ class Factory
         // If VuFind is configured to suppress the holdings tab when the
         // ILS driver specifies no holdings, we need to pass in a connection
         // object:
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         if (isset($config->Site->hideHoldingsTabWhenEmpty)
             && $config->Site->hideHoldingsTabWhenEmpty
         ) {
-            $catalog = $sm->getServiceLocator()->get('VuFind\ILSConnection');
+            $catalog = $sm->get('VuFind\ILSConnection');
         } else {
             $catalog = false;
         }
@@ -164,7 +164,7 @@ class Factory
      */
     public static function getHoldingsWorldCat(ServiceManager $sm)
     {
-        $bm = $sm->getServiceLocator()->get('VuFind\Search\BackendManager');
+        $bm = $sm->get('VuFind\Search\BackendManager');
         return new HoldingsWorldCat($bm->get('WorldCat')->getConnector());
     }
 
@@ -177,7 +177,7 @@ class Factory
      */
     public static function getMap(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $mapType = isset($config->Content->recordMap)
             ? $config->Content->recordMap : null;
         $options = [];
@@ -199,7 +199,7 @@ class Factory
      */
     public static function getPreview(ServiceManager $sm)
     {
-        $cfg = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $cfg = $sm->get('VuFind\Config')->get('config');
         // currently only active if config [content] [previews] contains google
         // and googleoptions[tab] is not empty.
         $active = false;
@@ -227,7 +227,7 @@ class Factory
     public static function getSimilarItemsCarousel(ServiceManager $sm)
     {
         return new SimilarItemsCarousel(
-            $sm->getServiceLocator()->get('VuFind\Search')
+            $sm->get('VuFind\Search')
         );
     }
 
@@ -240,10 +240,10 @@ class Factory
      */
     public static function getReviews(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         // Only instantiate the loader if the feature is enabled:
         if (isset($config->Content->reviews)) {
-            $loader = $sm->getServiceLocator()->get('VuFind\ContentPluginManager')
+            $loader = $sm->get('VuFind\ContentPluginManager')
                 ->get('reviews');
         } else {
             $loader = null;
@@ -260,10 +260,10 @@ class Factory
      */
     public static function getTOC(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         // Only instantiate the loader if the feature is enabled:
         if (isset($config->Content->toc)) {
-            $loader = $sm->getServiceLocator()->get('VuFind\ContentPluginManager')
+            $loader = $sm->get('VuFind\ContentPluginManager')
                 ->get('toc');
         } else {
             $loader = null;
@@ -280,8 +280,8 @@ class Factory
      */
     public static function getUserComments(ServiceManager $sm)
     {
-        $capabilities = $sm->getServiceLocator()->get('VuFind\AccountCapabilities');
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $capabilities = $sm->get('VuFind\AccountCapabilities');
+        $config = $sm->get('VuFind\Config')->get('config');
         $useRecaptcha = isset($config->Captcha) && isset($config->Captcha->forms)
             && (trim($config->Captcha->forms) === '*'
             || strpos($config->Captcha->forms, 'userComments'));
diff --git a/module/VuFind/src/VuFind/Related/Factory.php b/module/VuFind/src/VuFind/Related/Factory.php
index 4431faa1193..932b44c328e 100644
--- a/module/VuFind/src/VuFind/Related/Factory.php
+++ b/module/VuFind/src/VuFind/Related/Factory.php
@@ -52,8 +52,8 @@ class Factory
     public static function getEditions(ServiceManager $sm)
     {
         return new Editions(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'),
-            $sm->getServiceLocator()->get('VuFind\WorldCatUtils')
+            $sm->get('VuFind\SearchResultsPluginManager'),
+            $sm->get('VuFind\WorldCatUtils')
         );
     }
 
@@ -66,7 +66,7 @@ class Factory
      */
     public static function getSimilar(ServiceManager $sm)
     {
-        return new Similar($sm->getServiceLocator()->get('VuFind\Search'));
+        return new Similar($sm->get('VuFind\Search'));
     }
 
     /**
@@ -79,8 +79,8 @@ class Factory
     public static function getWorldCatEditions(ServiceManager $sm)
     {
         return new WorldCatEditions(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'),
-            $sm->getServiceLocator()->get('VuFind\WorldCatUtils')
+            $sm->get('VuFind\SearchResultsPluginManager'),
+            $sm->get('VuFind\WorldCatUtils')
         );
     }
 
@@ -93,6 +93,6 @@ class Factory
      */
     public static function getWorldCatSimilar(ServiceManager $sm)
     {
-        return new WorldCatSimilar($sm->getServiceLocator()->get('VuFind\Search'));
+        return new WorldCatSimilar($sm->get('VuFind\Search'));
     }
 }
diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Factory.php b/module/VuFind/src/VuFind/Resolver/Driver/Factory.php
index 59f67011686..c60f6f1ba86 100644
--- a/module/VuFind/src/VuFind/Resolver/Driver/Factory.php
+++ b/module/VuFind/src/VuFind/Resolver/Driver/Factory.php
@@ -51,10 +51,10 @@ class Factory
      */
     public static function getThreesixtylink(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Threesixtylink(
             $config->OpenURL->url,
-            $sm->getServiceLocator()->get('VuFind\Http')->createClient()
+            $sm->get('VuFind\Http')->createClient()
         );
     }
 
@@ -67,10 +67,10 @@ class Factory
      */
     public static function getEzb(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Ezb(
             $config->OpenURL->url,
-            $sm->getServiceLocator()->get('VuFind\Http')->createClient()
+            $sm->get('VuFind\Http')->createClient()
         );
     }
 
@@ -83,10 +83,10 @@ class Factory
      */
     public static function getSfx(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Sfx(
             $config->OpenURL->url,
-            $sm->getServiceLocator()->get('VuFind\Http')->createClient()
+            $sm->get('VuFind\Http')->createClient()
         );
     }
 
@@ -99,10 +99,10 @@ class Factory
      */
     public static function getRedi(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new Redi(
             $config->OpenURL->url,
-            $sm->getServiceLocator()->get('VuFind\Http')->createClient()
+            $sm->get('VuFind\Http')->createClient()
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php
index 731a7bab1b0..4184b5c8307 100644
--- a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php
+++ b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php
@@ -27,9 +27,9 @@
  */
 namespace VuFind\Role;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\Config;
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * VuFind dynamic role provider factory.
@@ -43,35 +43,39 @@ use Zend\ServiceManager\ServiceLocatorInterface;
 class DynamicRoleProviderFactory implements FactoryInterface
 {
     /**
-     * Create the service.
+     * Create service
      *
-     * @param ServiceLocatorInterface $serviceLocator Service locator
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
      * @return DynamicRoleProvider
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $config = $serviceLocator->getServiceLocator()->get('config');
+        $config = $sm->get('config');
         $rbacConfig = $config['zfc_rbac'];
         return new DynamicRoleProvider(
-            $this->getPermissionProviderPluginManager($serviceLocator, $rbacConfig),
-            $this->getPermissionConfiguration($serviceLocator, $rbacConfig)
+            $this->getPermissionProviderPluginManager($sm, $rbacConfig),
+            $this->getPermissionConfiguration($sm, $rbacConfig)
         );
     }
 
     /**
      * Create the supporting plugin manager.
      *
-     * @param ServiceLocatorInterface $serviceLocator Service locator
-     * @param array                   $rbacConfig     ZfcRbac configuration
+     * @param ContainerInterface $serviceLocator Service locator
+     * @param array              $rbacConfig     ZfcRbac configuration
      *
      * @return PermissionProviderPluginManager
      */
     protected function getPermissionProviderPluginManager(
-        ServiceLocatorInterface $serviceLocator, array $rbacConfig
+        ContainerInterface $serviceLocator, array $rbacConfig
     ) {
         $pm = new PermissionProvider\PluginManager(
-            $serviceLocator->getServiceLocator(),
+            $serviceLocator,
             $rbacConfig['vufind_permission_provider_manager']
         );
         return $pm;
@@ -80,19 +84,19 @@ class DynamicRoleProviderFactory implements FactoryInterface
     /**
      * Get a configuration array.
      *
-     * @param ServiceLocatorInterface $serviceLocator Service locator
-     * @param array                   $rbacConfig     ZfcRbac configuration
+     * @param ContainerInterface $serviceLocator Service locator
+     * @param array              $rbacConfig     ZfcRbac configuration
      *
      * @return array
      */
     protected function getPermissionConfiguration(
-        ServiceLocatorInterface $serviceLocator, array $rbacConfig
+        ContainerInterface $serviceLocator, array $rbacConfig
     ) {
         // Get role provider settings from the ZfcRbac configuration:
         $config = $rbacConfig['role_provider']['VuFind\Role\DynamicRoleProvider'];
 
         // Load the permissions:
-        $configLoader = $serviceLocator->getServiceLocator()->get('VuFind\Config');
+        $configLoader = $serviceLocator->get('VuFind\Config');
         $permissions = $configLoader->get('permissions')->toArray();
 
         // If we're configured to map legacy settings, do so now:
diff --git a/module/VuFind/src/VuFind/Role/PermissionProvider/Factory.php b/module/VuFind/src/VuFind/Role/PermissionProvider/Factory.php
index 2e1c6423c41..e3b70a80aef 100644
--- a/module/VuFind/src/VuFind/Role/PermissionProvider/Factory.php
+++ b/module/VuFind/src/VuFind/Role/PermissionProvider/Factory.php
@@ -52,8 +52,8 @@ class Factory
     public static function getIpRange(ServiceManager $sm)
     {
         return new IpRange(
-            $sm->getServiceLocator()->get('Request'),
-            $sm->getServiceLocator()->get('VuFind\IpAddressUtils')
+            $sm->get('Request'),
+            $sm->get('VuFind\IpAddressUtils')
         );
     }
 
@@ -66,7 +66,7 @@ class Factory
      */
     public static function getIpRegEx(ServiceManager $sm)
     {
-        return new IpRegEx($sm->getServiceLocator()->get('Request'));
+        return new IpRegEx($sm->get('Request'));
     }
 
     /**
@@ -78,7 +78,7 @@ class Factory
      */
     public static function getServerParam(ServiceManager $sm)
     {
-        return new ServerParam($sm->getServiceLocator()->get('Request'));
+        return new ServerParam($sm->get('Request'));
     }
 
     /**
@@ -91,8 +91,8 @@ class Factory
     public static function getShibboleth(ServiceManager $sm)
     {
         return new Shibboleth(
-            $sm->getServiceLocator()->get('Request'),
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm->get('Request'),
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -106,7 +106,7 @@ class Factory
     public static function getUsername(ServiceManager $sm)
     {
         return new Username(
-            $sm->getServiceLocator()->get('ZfcRbac\Service\AuthorizationService')
+            $sm->get('ZfcRbac\Service\AuthorizationService')
         );
     }
 
@@ -120,7 +120,7 @@ class Factory
     public static function getUser(ServiceManager $sm)
     {
         return new User(
-            $sm->getServiceLocator()->get('ZfcRbac\Service\AuthorizationService')
+            $sm->get('ZfcRbac\Service\AuthorizationService')
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/SMS/Factory.php b/module/VuFind/src/VuFind/SMS/Factory.php
index 72346f22f31..8c7dc15328b 100644
--- a/module/VuFind/src/VuFind/SMS/Factory.php
+++ b/module/VuFind/src/VuFind/SMS/Factory.php
@@ -27,7 +27,8 @@
  */
 namespace VuFind\SMS;
 
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Interop\Container\ContainerInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for instantiating SMS objects
@@ -40,16 +41,20 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  *
  * @codeCoverageIgnore
  */
-class Factory implements \Zend\ServiceManager\FactoryInterface
+class Factory implements FactoryInterface
 {
     /**
      * Create service
      *
-     * @param ServiceLocatorInterface $sm Service manager
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @return mixed
+     * @return SMSInterface
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $sm)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
         // Load configurations:
         $mainConfig = $sm->get('VuFind\Config')->get('config');
diff --git a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
index 9c9c2c86202..25dccf7efd7 100644
--- a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
@@ -28,6 +28,8 @@
  */
 namespace VuFind\Search\Factory;
 
+use Interop\Container\ContainerInterface;
+
 use VuFind\Search\Solr\DeduplicationListener;
 use VuFind\Search\Solr\FilterFieldConversionListener;
 use VuFind\Search\Solr\HideFacetValueListener;
@@ -49,8 +51,7 @@ use VuFindSearch\Backend\Solr\SimilarBuilder;
 
 use Zend\Config\Config;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Abstract factory for SOLR backends.
@@ -73,7 +74,7 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -127,15 +128,19 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
     }
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $this->config         = $this->serviceLocator->get('VuFind\Config');
         if ($this->serviceLocator->has('VuFind\Logger')) {
             $this->logger = $this->serviceLocator->get('VuFind\Logger');
diff --git a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php
index faafd2f702c..d058fad9756 100644
--- a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php
@@ -28,13 +28,14 @@
  */
 namespace VuFind\Search\Factory;
 
+use Interop\Container\ContainerInterface;
+
 use VuFindSearch\Backend\BrowZine\Backend;
 use VuFindSearch\Backend\BrowZine\Connector;
 use VuFindSearch\Backend\BrowZine\QueryBuilder;
 use VuFindSearch\Backend\BrowZine\Response\RecordCollectionFactory;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for BrowZine backend.
@@ -57,7 +58,7 @@ class BrowZineBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -69,15 +70,19 @@ class BrowZineBackendFactory implements FactoryInterface
     protected $browzineConfig;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $configReader = $this->serviceLocator->get('VuFind\Config');
         $this->browzineConfig = $configReader->get('BrowZine');
         if ($this->serviceLocator->has('VuFind\Logger')) {
diff --git a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php
index 8eec6fc50da..a14393b2dd5 100644
--- a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php
@@ -28,14 +28,14 @@
  */
 namespace VuFind\Search\Factory;
 
-use VuFindSearch\Backend\BackendInterface;
+use Interop\Container\ContainerInterface;
+
 use VuFindSearch\Backend\EIT\Backend;
 use VuFindSearch\Backend\EIT\Connector;
 use VuFindSearch\Backend\EIT\QueryBuilder;
 use VuFindSearch\Backend\EIT\Response\XML\RecordCollectionFactory;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for EIT backends.
@@ -59,7 +59,7 @@ class EITBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -71,15 +71,19 @@ class EITBackendFactory implements FactoryInterface
     protected $config;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $this->config = $this->serviceLocator->get('VuFind\Config')->get('EIT');
         if ($this->serviceLocator->has('VuFind\Logger')) {
             $this->logger = $this->serviceLocator->get('VuFind\Logger');
diff --git a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php
index 6f265388adf..c02fb2b99f6 100644
--- a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php
@@ -28,14 +28,14 @@
  */
 namespace VuFind\Search\Factory;
 
-use VuFindSearch\Backend\BackendInterface;
+use Interop\Container\ContainerInterface;
+
 use VuFindSearch\Backend\EDS\Backend;
 use VuFindSearch\Backend\EDS\QueryBuilder;
 use VuFindSearch\Backend\EDS\Response\RecordCollectionFactory;
 use VuFindSearch\Backend\EDS\Zend2 as Connector;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for EDS backends.
@@ -58,7 +58,7 @@ class EdsBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -77,15 +77,19 @@ class EdsBackendFactory implements FactoryInterface
     protected $accountData;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $this->edsConfig = $this->serviceLocator->get('VuFind\Config')->get('EDS');
         if ($this->serviceLocator->has('VuFind\Logger')) {
             $this->logger = $this->serviceLocator->get('VuFind\Logger');
diff --git a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php
index 414c12b7778..fff3d2061e4 100644
--- a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php
@@ -28,14 +28,14 @@
  */
 namespace VuFind\Search\Factory;
 
-use VuFindSearch\Backend\BackendInterface;
+use Interop\Container\ContainerInterface;
+
 use VuFindSearch\Backend\LibGuides\Backend;
 use VuFindSearch\Backend\LibGuides\Connector;
 use VuFindSearch\Backend\LibGuides\QueryBuilder;
 use VuFindSearch\Backend\LibGuides\Response\RecordCollectionFactory;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for LibGuides backends.
@@ -58,7 +58,7 @@ class LibGuidesBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -70,15 +70,19 @@ class LibGuidesBackendFactory implements FactoryInterface
     protected $libGuidesConfig;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $configReader = $this->serviceLocator->get('VuFind\Config');
         $this->libGuidesConfig = $configReader->get('LibGuides');
         if ($this->serviceLocator->has('VuFind\Logger')) {
diff --git a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php
index 93d2f22833f..f97393eb6bd 100644
--- a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php
@@ -28,14 +28,14 @@
  */
 namespace VuFind\Search\Factory;
 
-use VuFindSearch\Backend\BackendInterface;
+use Interop\Container\ContainerInterface;
+
 use VuFindSearch\Backend\Pazpar2\Backend;
 use VuFindSearch\Backend\Pazpar2\Connector;
 use VuFindSearch\Backend\Pazpar2\QueryBuilder;
 use VuFindSearch\Backend\Pazpar2\Response\RecordCollectionFactory;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for Pazpar2 backends.
@@ -58,7 +58,7 @@ class Pazpar2BackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -70,15 +70,19 @@ class Pazpar2BackendFactory implements FactoryInterface
     protected $config;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $this->config = $this->serviceLocator->get('VuFind\Config')->get('Pazpar2');
         if ($this->serviceLocator->has('VuFind\Logger')) {
             $this->logger = $this->serviceLocator->get('VuFind\Logger');
diff --git a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php
index 2d819402bf6..9e6e19344e2 100644
--- a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php
@@ -28,17 +28,17 @@
  */
 namespace VuFind\Search\Factory;
 
+use Interop\Container\ContainerInterface;
+
 use VuFind\Search\Primo\InjectOnCampusListener;
 use VuFind\Search\Primo\PrimoPermissionHandler;
-use VuFindSearch\Backend\BackendInterface;
 use VuFindSearch\Backend\Primo\Backend;
 use VuFindSearch\Backend\Primo\Connector;
 
 use VuFindSearch\Backend\Primo\QueryBuilder;
 use VuFindSearch\Backend\Primo\Response\RecordCollectionFactory;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for Primo Central backends.
@@ -61,7 +61,7 @@ class PrimoBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -73,15 +73,19 @@ class PrimoBackendFactory implements FactoryInterface
     protected $primoConfig;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $configReader = $this->serviceLocator->get('VuFind\Config');
         $this->primoConfig = $configReader->get('Primo');
         if ($this->serviceLocator->has('VuFind\Logger')) {
diff --git a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php
index fc3b78b7c13..60d70a64ca8 100644
--- a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php
@@ -28,15 +28,15 @@
  */
 namespace VuFind\Search\Factory;
 
+use Interop\Container\ContainerInterface;
+
 use SerialsSolutions\Summon\Zend2 as Connector;
-use VuFindSearch\Backend\BackendInterface;
 use VuFindSearch\Backend\Solr\LuceneSyntaxHelper;
 use VuFindSearch\Backend\Summon\Backend;
 use VuFindSearch\Backend\Summon\QueryBuilder;
 use VuFindSearch\Backend\Summon\Response\RecordCollectionFactory;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for Summon backends.
@@ -59,7 +59,7 @@ class SummonBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -78,15 +78,19 @@ class SummonBackendFactory implements FactoryInterface
     protected $summonConfig;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $configReader = $this->serviceLocator->get('VuFind\Config');
         $this->config = $configReader->get('config');
         $this->summonConfig = $configReader->get('Summon');
diff --git a/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php
index 030778b6c82..4e9b0d4a86a 100644
--- a/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php
@@ -28,14 +28,14 @@
  */
 namespace VuFind\Search\Factory;
 
-use VuFindSearch\Backend\BackendInterface;
+use Interop\Container\ContainerInterface;
+
 use VuFindSearch\Backend\WorldCat\Backend;
 use VuFindSearch\Backend\WorldCat\Connector;
 use VuFindSearch\Backend\WorldCat\QueryBuilder;
 use VuFindSearch\Backend\WorldCat\Response\XML\RecordCollectionFactory;
 
-use Zend\ServiceManager\FactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 
 /**
  * Factory for WorldCat backends.
@@ -58,7 +58,7 @@ class WorldCatBackendFactory implements FactoryInterface
     /**
      * Superior service manager.
      *
-     * @var ServiceLocatorInterface
+     * @var ContainerInterface
      */
     protected $serviceLocator;
 
@@ -77,15 +77,19 @@ class WorldCatBackendFactory implements FactoryInterface
     protected $wcConfig;
 
     /**
-     * Create the backend.
+     * Create service
+     *
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @param ServiceLocatorInterface $serviceLocator Superior service manager
+     * @return Backend
      *
-     * @return BackendInterface
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $serviceLocator)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
-        $this->serviceLocator = $serviceLocator->getServiceLocator();
+        $this->serviceLocator = $sm;
         $this->config = $this->serviceLocator->get('VuFind\Config')->get('config');
         $this->wcConfig = $this->serviceLocator
             ->get('VuFind\Config')->get('WorldCat');
diff --git a/module/VuFind/src/VuFind/Search/Options/Factory.php b/module/VuFind/src/VuFind/Search/Options/Factory.php
index 08cdf57882c..7ad04cdc5b8 100644
--- a/module/VuFind/src/VuFind/Search/Options/Factory.php
+++ b/module/VuFind/src/VuFind/Search/Options/Factory.php
@@ -51,13 +51,13 @@ class Factory
      */
     public static function getEDS(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config');
+        $config = $sm->get('VuFind\Config');
         $container = new \Zend\Session\Container(
-            'EBSCO', $sm->getServiceLocator()->get('VuFind\SessionManager')
+            'EBSCO', $sm->get('VuFind\SessionManager')
         );
         // No API info in session? Re-establish connection:
         if (!isset($container->info)) {
-            $backend = $sm->getServiceLocator()->get('VuFind\Search\BackendManager')
+            $backend = $sm->get('VuFind\Search\BackendManager')
                 ->get('EDS');
             $backend->getSessionToken();
         }
diff --git a/module/VuFind/src/VuFind/Search/Options/PluginFactory.php b/module/VuFind/src/VuFind/Search/Options/PluginFactory.php
index 08d98c1bf39..8d1ee3bd7ab 100644
--- a/module/VuFind/src/VuFind/Search/Options/PluginFactory.php
+++ b/module/VuFind/src/VuFind/Search/Options/PluginFactory.php
@@ -64,8 +64,6 @@ class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory
         array $options = null
     ) {
         $class = $this->getClassName($requestedName);
-        return new $class(
-            $container->getServiceLocator()->get('VuFind\Config')
-        );
+        return new $class($container->get('VuFind\Config'));
     }
 }
diff --git a/module/VuFind/src/VuFind/Search/Params/Factory.php b/module/VuFind/src/VuFind/Search/Params/Factory.php
index 55b4e3ae758..399bfaca284 100644
--- a/module/VuFind/src/VuFind/Search/Params/Factory.php
+++ b/module/VuFind/src/VuFind/Search/Params/Factory.php
@@ -52,7 +52,7 @@ class Factory
     public static function getSolr(ServiceManager $sm)
     {
         $factory = new PluginFactory();
-        $helper = $sm->getServiceLocator()->get('VuFind\HierarchicalFacetHelper');
+        $helper = $sm->get('VuFind\HierarchicalFacetHelper');
         return $factory($sm, 'Solr', [$helper]);
     }
 }
diff --git a/module/VuFind/src/VuFind/Search/Params/PluginFactory.php b/module/VuFind/src/VuFind/Search/Params/PluginFactory.php
index 168a7d5741d..5993cfd7ffd 100644
--- a/module/VuFind/src/VuFind/Search/Params/PluginFactory.php
+++ b/module/VuFind/src/VuFind/Search/Params/PluginFactory.php
@@ -63,10 +63,10 @@ class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory
     public function __invoke(ContainerInterface $container, $requestedName,
         array $extras = null
     ) {
-        $options = $container->getServiceLocator()
-            ->get('VuFind\SearchOptionsPluginManager')->get($requestedName);
+        $options = $container->get('VuFind\SearchOptionsPluginManager')
+            ->get($requestedName);
         $class = $this->getClassName($requestedName);
-        $configLoader = $container->getServiceLocator()->get('VuFind\Config');
+        $configLoader = $container->get('VuFind\Config');
         // Clone the options instance in case caller modifies it:
         return new $class(clone $options, $configLoader, ...($extras ?: []));
     }
diff --git a/module/VuFind/src/VuFind/Search/Results/Factory.php b/module/VuFind/src/VuFind/Search/Results/Factory.php
index 0dad692de6a..ce327220ac8 100644
--- a/module/VuFind/src/VuFind/Search/Results/Factory.php
+++ b/module/VuFind/src/VuFind/Search/Results/Factory.php
@@ -52,7 +52,7 @@ class Factory
     public static function getFavorites(ServiceManager $sm)
     {
         $factory = new PluginFactory();
-        $tm = $sm->getServiceLocator()->get('VuFind\DbTablePluginManager');
+        $tm = $sm->get('VuFind\DbTablePluginManager');
         $obj = $factory(
             $sm, 'Favorites',
             [$tm->get('Resource'), $tm->get('UserList')]
@@ -73,8 +73,7 @@ class Factory
     {
         $factory = new PluginFactory();
         $solr = $factory($sm, 'Solr');
-        $config = $sm->getServiceLocator()
-            ->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $spellConfig = isset($config->Spelling)
             ? $config->Spelling : null;
         $solr->setSpellingProcessor(
@@ -93,7 +92,7 @@ class Factory
     public static function getTags(ServiceManager $sm)
     {
         $factory = new PluginFactory();
-        $tm = $sm->getServiceLocator()->get('VuFind\DbTablePluginManager');
+        $tm = $sm->get('VuFind\DbTablePluginManager');
         return $factory($sm, 'Tags', [$tm->get('Tags')]);
     }
 }
diff --git a/module/VuFind/src/VuFind/Search/Results/PluginFactory.php b/module/VuFind/src/VuFind/Search/Results/PluginFactory.php
index f12b0d56bbc..63fb6e1ccae 100644
--- a/module/VuFind/src/VuFind/Search/Results/PluginFactory.php
+++ b/module/VuFind/src/VuFind/Search/Results/PluginFactory.php
@@ -63,12 +63,10 @@ class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory
     public function __invoke(ContainerInterface $container, $requestedName,
         array $extras = null
     ) {
-        $params = $container->getServiceLocator()
-            ->get('VuFind\SearchParamsPluginManager')->get($requestedName);
-        $searchService = $serviceLocator->getServiceLocator()
-            ->get('VuFind\Search');
-        $recordLoader = $serviceLocator->getServiceLocator()
-            ->get('VuFind\RecordLoader');
+        $params = $container->get('VuFind\SearchParamsPluginManager')
+            ->get($requestedName);
+        $searchService = $container->get('VuFind\Search');
+        $recordLoader = $container->get('VuFind\RecordLoader');
         $class = $this->getClassName($requestedName);
         return new $class(
             $params, $searchService, $recordLoader, ...($extras ?: [])
diff --git a/module/VuFind/src/VuFind/ServiceManager/AbstractPluginFactory.php b/module/VuFind/src/VuFind/ServiceManager/AbstractPluginFactory.php
index c09914972a3..4e5815968f8 100644
--- a/module/VuFind/src/VuFind/ServiceManager/AbstractPluginFactory.php
+++ b/module/VuFind/src/VuFind/ServiceManager/AbstractPluginFactory.php
@@ -27,8 +27,8 @@
  */
 namespace VuFind\ServiceManager;
 
-use Zend\ServiceManager\AbstractFactoryInterface;
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Interop\Container\ContainerInterface;
+use Zend\ServiceManager\Factory\AbstractFactoryInterface;
 
 /**
  * VuFind Abstract Plugin Factory
@@ -58,12 +58,11 @@ abstract class AbstractPluginFactory implements AbstractFactoryInterface
     /**
      * Get the name of a class for a given plugin name.
      *
-     * @param string $name          Name of service
-     * @param string $requestedName Unfiltered name of service
+     * @param string $requestedName Name of service
      *
      * @return string               Fully qualified class name
      */
-    protected function getClassName($name, $requestedName)
+    protected function getClassName($requestedName)
     {
         // If we have a FQCN that refers to an existing class, return it as-is:
         if (strpos($requestedName, '\\') !== false && class_exists($requestedName)) {
@@ -73,8 +72,8 @@ abstract class AbstractPluginFactory implements AbstractFactoryInterface
         $finalName = $this->defaultNamespace . '\\' . $requestedName
             . $this->classSuffix;
         if (!class_exists($finalName)) {
-            $finalName = $this->defaultNamespace . '\\' . ucwords(strtolower($name))
-                . $this->classSuffix;
+            $finalName = $this->defaultNamespace . '\\'
+                . ucwords(strtolower($requestedName)) . $this->classSuffix;
         }
         return $finalName;
     }
@@ -82,36 +81,33 @@ abstract class AbstractPluginFactory implements AbstractFactoryInterface
     /**
      * Can we create a service for the specified name?
      *
-     * @param ServiceLocatorInterface $serviceLocator Service locator
-     * @param string                  $name           Name of service
-     * @param string                  $requestedName  Unfiltered name of service
+     * @param ContainerInterface $container     Service container
+     * @param string             $requestedName Name of service
      *
      * @return bool
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator,
-        $name, $requestedName
-    ) {
-        $className = $this->getClassName($name, $requestedName);
-        return class_exists($className);
+    public function canCreate(ContainerInterface $container, $requestedName)
+    {
+        return class_exists($this->getClassName($requestedName));
     }
 
     /**
      * Create a service for the specified name.
      *
-     * @param ServiceLocatorInterface $serviceLocator Service locator
-     * @param string                  $name           Name of service
-     * @param string                  $requestedName  Unfiltered name of service
+     * @param ContainerInterface $container     Service container
+     * @param string             $requestedName Name of service
+     * @param array              $options       Options (unused)
      *
      * @return object
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createServiceWithName(ServiceLocatorInterface $serviceLocator,
-        $name, $requestedName
+    public function __invoke(ContainerInterface $container, $requestedName,
+        array $options = null
     ) {
-        $class = $this->getClassName($name, $requestedName);
+        $class = $this->getClassName($requestedName);
         return new $class();
     }
 }
diff --git a/module/VuFind/src/VuFind/Session/ManagerFactory.php b/module/VuFind/src/VuFind/Session/ManagerFactory.php
index 1cf2e5d7723..d004331fdc2 100644
--- a/module/VuFind/src/VuFind/Session/ManagerFactory.php
+++ b/module/VuFind/src/VuFind/Session/ManagerFactory.php
@@ -27,7 +27,8 @@
  */
 namespace VuFind\Session;
 
-use Zend\ServiceManager\ServiceLocatorInterface;
+use Interop\Container\ContainerInterface;
+use Zend\ServiceManager\Factory\FactoryInterface;
 use Zend\Session\SessionManager;
 
 /**
@@ -41,16 +42,16 @@ use Zend\Session\SessionManager;
  *
  * @codeCoverageIgnore
  */
-class ManagerFactory implements \Zend\ServiceManager\FactoryInterface
+class ManagerFactory implements FactoryInterface
 {
     /**
      * Build the options array.
      *
-     * @param ServiceLocatorInterface $sm Service manager
+     * @param ContainerInterface $sm Service manager
      *
      * @return array
      */
-    protected function getOptions(ServiceLocatorInterface $sm)
+    protected function getOptions(ContainerInterface $sm)
     {
         $cookieManager = $sm->get('VuFind\CookieManager');
         $options = [
@@ -75,11 +76,11 @@ class ManagerFactory implements \Zend\ServiceManager\FactoryInterface
      * Set up the session handler by retrieving all the pieces from the service
      * manager and injecting appropriate dependencies.
      *
-     * @param ServiceLocatorInterface $sm Service manager
+     * @param ContainerInterface $sm Service manager
      *
      * @return array
      */
-    protected function getHandler(ServiceLocatorInterface $sm)
+    protected function getHandler(ContainerInterface $sm)
     {
         // Load and validate session configuration:
         $config = $sm->get('VuFind\Config')->get('config');
@@ -119,11 +120,15 @@ class ManagerFactory implements \Zend\ServiceManager\FactoryInterface
     /**
      * Create service
      *
-     * @param ServiceLocatorInterface $sm Service manager
+     * @param ContainerInterface $sm      Service manager
+     * @param string             $name    Requested service name (unused)
+     * @param array              $options Extra options (unused)
      *
-     * @return mixed
+     * @return SessionManager
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function createService(ServiceLocatorInterface $sm)
+    public function __invoke(ContainerInterface $sm, $name, array $options = null)
     {
         // Build configuration:
         $sessionConfig = new \Zend\Session\Config\SessionConfig();
diff --git a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php
index b6d9b9c104d..756d51357a2 100644
--- a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php
+++ b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php
@@ -51,8 +51,8 @@ class Factory
      */
     public static function getFlashmessages(ServiceManager $sm)
     {
-        $messenger = $sm->getServiceLocator()->get('ControllerPluginManager')
-            ->get('FlashMessenger');
+        $messenger = $sm->get('ControllerPluginManager')
+            ->get('Zend\Mvc\Plugin\FlashMessenger\FlashMessenger');
         return new Flashmessages($messenger);
     }
 
@@ -65,7 +65,7 @@ class Factory
      */
     public static function getLayoutClass(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $sidebarOnLeft = !isset($config->Site->sidebarOnLeft)
             ? false : $config->Site->sidebarOnLeft;
         $mirror = !isset($config->Site->mirrorSidebarInRTL)
@@ -75,7 +75,7 @@ class Factory
         // The right-to-left setting is injected into the layout by the Bootstrapper;
         // pull it back out here to avoid duplicate effort, then use it to apply
         // the mirror setting appropriately.
-        $layout = $sm->getServiceLocator()->get('ViewManager')->getViewModel();
+        $layout = $sm->get('ViewManager')->getViewModel();
         if ($layout->rtl && $mirror) {
             $sidebarOnLeft = !$sidebarOnLeft;
         }
@@ -92,8 +92,8 @@ class Factory
     public static function getRecaptcha(ServiceManager $sm)
     {
         return new Recaptcha(
-            $sm->getServiceLocator()->get('VuFind\Recaptcha'),
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm->get('VuFind\Recaptcha'),
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php
index efccfd753ea..3efa53d6c83 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php
@@ -51,7 +51,7 @@ class Factory
      */
     public static function getAddThis(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new AddThis(
             isset($config->AddThis->key) ? $config->AddThis->key : false
         );
@@ -67,7 +67,7 @@ class Factory
     public static function getAccountCapabilities(ServiceManager $sm)
     {
         return new AccountCapabilities(
-            $sm->getServiceLocator()->get('VuFind\AccountCapabilities')
+            $sm->get('VuFind\AccountCapabilities')
         );
     }
 
@@ -80,7 +80,8 @@ class Factory
      */
     public static function getAlphaBrowse(ServiceManager $sm)
     {
-        return new AlphaBrowse($sm->get('url'));
+        $helpers = $sm->get('ViewHelperManager');
+        return new AlphaBrowse($helpers->get('url'));
     }
 
     /**
@@ -93,8 +94,8 @@ class Factory
     public static function getAuth(ServiceManager $sm)
     {
         return new Auth(
-            $sm->getServiceLocator()->get('VuFind\AuthManager'),
-            $sm->getServiceLocator()->get('VuFind\ILSAuthenticator')
+            $sm->get('VuFind\AuthManager'),
+            $sm->get('VuFind\ILSAuthenticator')
         );
     }
 
@@ -107,7 +108,7 @@ class Factory
      */
     public static function getAuthorNotes(ServiceManager $sm)
     {
-        $loader = $sm->getServiceLocator()->get('VuFind\ContentPluginManager')
+        $loader = $sm->get('VuFind\ContentPluginManager')
             ->get('authornotes');
         return new ContentLoader($loader);
     }
@@ -121,7 +122,7 @@ class Factory
      */
     public static function getCart(ServiceManager $sm)
     {
-        return new Cart($sm->getServiceLocator()->get('VuFind\Cart'));
+        return new Cart($sm->get('VuFind\Cart'));
     }
 
     /**
@@ -133,7 +134,7 @@ class Factory
      */
     public static function getCitation(ServiceManager $sm)
     {
-        return new Citation($sm->getServiceLocator()->get('VuFind\DateConverter'));
+        return new Citation($sm->get('VuFind\DateConverter'));
     }
 
     /**
@@ -145,7 +146,7 @@ class Factory
      */
     public static function getDateTime(ServiceManager $sm)
     {
-        return new DateTime($sm->getServiceLocator()->get('VuFind\DateConverter'));
+        return new DateTime($sm->get('VuFind\DateConverter'));
     }
 
     /**
@@ -161,7 +162,7 @@ class Factory
         // since it configures different language/locale than the core shared
         // instance!
         return new DisplayLanguageOption(
-            \VuFind\Service\Factory::getTranslator($sm->getServiceLocator())
+            \VuFind\Service\Factory::getTranslator($sm)
         );
     }
 
@@ -174,7 +175,7 @@ class Factory
      */
     public static function getExport(ServiceManager $sm)
     {
-        return new Export($sm->getServiceLocator()->get('VuFind\Export'));
+        return new Export($sm->get('VuFind\Export'));
     }
 
     /**
@@ -186,7 +187,7 @@ class Factory
      */
     public static function getFeedback(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $enabled = isset($config->Feedback->tab_enabled)
             ? $config->Feedback->tab_enabled : false;
         return new Feedback($enabled);
@@ -201,8 +202,8 @@ class Factory
      */
     public static function getFlashmessages(ServiceManager $sm)
     {
-        $messenger = $sm->getServiceLocator()->get('ControllerPluginManager')
-            ->get('FlashMessenger');
+        $messenger = $sm->get('ControllerPluginManager')
+            ->get('Zend\Mvc\Plugin\FlashMessenger\FlashMessenger');
         return new Flashmessages($messenger);
     }
 
@@ -215,7 +216,7 @@ class Factory
      */
     public static function getGeoCoords(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('searches');
+        $config = $sm->get('VuFind\Config')->get('searches');
         $coords = isset($config->MapSelection->default_coordinates)
             ? $config->MapSelection->default_coordinates : false;
         return new GeoCoords($coords);
@@ -230,7 +231,7 @@ class Factory
      */
     public static function getGoogleAnalytics(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $key = isset($config->GoogleAnalytics->apiKey)
             ? $config->GoogleAnalytics->apiKey : false;
         $universal = isset($config->GoogleAnalytics->universal)
@@ -248,8 +249,8 @@ class Factory
     public static function getPermission(ServiceManager $sm)
     {
         $ld = new Permission(
-            $sm->getServiceLocator()->get('VuFind\Role\PermissionManager'),
-            $sm->getServiceLocator()->get('VuFind\Role\PermissionDeniedManager')
+            $sm->get('VuFind\Role\PermissionManager'),
+            $sm->get('VuFind\Role\PermissionDeniedManager')
         );
         return $ld;
     }
@@ -263,7 +264,7 @@ class Factory
      */
     public static function getPiwik(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $url = isset($config->Piwik->url) ? $config->Piwik->url : false;
         $options = [
             'siteId' => isset($config->Piwik->site_id) ? $config->Piwik->site_id : 1,
@@ -273,8 +274,8 @@ class Factory
         $customVars = isset($config->Piwik->custom_variables)
             ? $config->Piwik->custom_variables
             : false;
-        $request = $sm->getServiceLocator()->get('Request');
-        $router = $sm->getServiceLocator()->get('Router');
+        $request = $sm->get('Request');
+        $router = $sm->get('Router');
         return new Piwik($url, $options, $customVars, $router, $request);
     }
 
@@ -287,10 +288,11 @@ class Factory
      */
     public static function getHelpText(ServiceManager $sm)
     {
-        $lang = $sm->getServiceLocator()->has('VuFind\Translator')
-            ? $sm->getServiceLocator()->get('VuFind\Translator')->getLocale()
+        $lang = $sm->has('VuFind\Translator')
+            ? $sm->get('VuFind\Translator')->getLocale()
             : 'en';
-        return new HelpText($sm->get('context'), $lang);
+        $helpers = $sm->get('ViewHelperManager');
+        return new HelpText($helpers->get('context'), $lang);
     }
 
     /**
@@ -302,10 +304,11 @@ class Factory
      */
     public static function getHistoryLabel(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $config = isset($config->SearchHistoryLabels)
             ? $config->SearchHistoryLabels->toArray() : [];
-        return new HistoryLabel($config, $sm->get('transEsc'));
+        $helpers = $sm->get('ViewHelperManager');
+        return new HistoryLabel($config, $helpers->get('transEsc'));
     }
 
     /**
@@ -317,7 +320,7 @@ class Factory
      */
     public static function getIls(ServiceManager $sm)
     {
-        return new Ils($sm->getServiceLocator()->get('VuFind\ILSConnection'));
+        return new Ils($sm->get('VuFind\ILSConnection'));
     }
 
     /**
@@ -329,7 +332,8 @@ class Factory
      */
     public static function getJsTranslations(ServiceManager $sm)
     {
-        return new JsTranslations($sm->get('transEsc'));
+        $helpers = $sm->get('ViewHelperManager');
+        return new JsTranslations($helpers->get('transEsc'));
     }
 
     /**
@@ -341,7 +345,7 @@ class Factory
      */
     public static function getKeepAlive(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new KeepAlive(
             isset($config->Session->keepAlive) ? $config->Session->keepAlive : 0
         );
@@ -356,17 +360,18 @@ class Factory
      */
     public static function getOpenUrl(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $openUrlRules = json_decode(
             file_get_contents(
                 \VuFind\Config\Locator::getConfigPath('OpenUrlRules.json')
             ),
             true
         );
-        $resolverPluginManager = $sm->getServiceLocator()
+        $resolverPluginManager = $sm
             ->get('VuFind\ResolverDriverPluginManager');
+        $helpers = $sm->get('ViewHelperManager');
         return new OpenUrl(
-            $sm->get('context'),
+            $helpers->get('context'),
             $openUrlRules,
             $resolverPluginManager,
             isset($config->OpenURL) ? $config->OpenURL : null
@@ -383,7 +388,7 @@ class Factory
     public static function getProxyUrl(ServiceManager $sm)
     {
         return new ProxyUrl(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -397,8 +402,8 @@ class Factory
     public static function getRecaptcha(ServiceManager $sm)
     {
         return new Recaptcha(
-            $sm->getServiceLocator()->get('VuFind\Recaptcha'),
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm->get('VuFind\Recaptcha'),
+            $sm->get('VuFind\Config')->get('config')
         );
     }
 
@@ -412,10 +417,10 @@ class Factory
     public static function getRecord(ServiceManager $sm)
     {
         $helper = new Record(
-            $sm->getServiceLocator()->get('VuFind\Config')->get('config')
+            $sm->get('VuFind\Config')->get('config')
         );
         $helper->setCoverRouter(
-            $sm->getServiceLocator()->get('VuFind\Cover\Router')
+            $sm->get('VuFind\Cover\Router')
         );
         return $helper;
     }
@@ -429,7 +434,7 @@ class Factory
      */
     public static function getRecordLink(ServiceManager $sm)
     {
-        return new RecordLink($sm->getServiceLocator()->get('VuFind\RecordRouter'));
+        return new RecordLink($sm->get('VuFind\RecordRouter'));
     }
 
     /**
@@ -442,7 +447,7 @@ class Factory
     public static function getRelated(ServiceManager $sm)
     {
         return new Related(
-            $sm->getServiceLocator()->get('VuFind\RelatedPluginManager')
+            $sm->get('VuFind\RelatedPluginManager')
         );
     }
 
@@ -469,7 +474,7 @@ class Factory
      */
     public static function getSafeMoneyFormat(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $defaultCurrency = isset($config->Site->defaultCurrency)
             ? $config->Site->defaultCurrency : null;
         return new SafeMoneyFormat($defaultCurrency);
@@ -484,14 +489,14 @@ class Factory
      */
     public static function getSearchBox(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config');
+        $config = $sm->get('VuFind\Config');
         $mainConfig = $config->get('config');
         $searchboxConfig = $config->get('searchbox')->toArray();
         $includeAlphaOptions
             = isset($searchboxConfig['General']['includeAlphaBrowse'])
             && $searchboxConfig['General']['includeAlphaBrowse'];
         return new SearchBox(
-            $sm->getServiceLocator()->get('VuFind\SearchOptionsPluginManager'),
+            $sm->get('VuFind\SearchOptionsPluginManager'),
             $searchboxConfig,
             isset($mainConfig->SearchPlaceholder)
                 ? $mainConfig->SearchPlaceholder->toArray() : [],
@@ -510,7 +515,7 @@ class Factory
     public static function getSearchMemory(ServiceManager $sm)
     {
         return new SearchMemory(
-            $sm->getServiceLocator()->get('VuFind\Search\Memory')
+            $sm->get('VuFind\Search\Memory')
         );
     }
 
@@ -524,7 +529,7 @@ class Factory
     public static function getSearchOptions(ServiceManager $sm)
     {
         return new SearchOptions(
-            $sm->getServiceLocator()->get('VuFind\SearchOptionsPluginManager')
+            $sm->get('VuFind\SearchOptionsPluginManager')
         );
     }
 
@@ -538,7 +543,7 @@ class Factory
     public static function getSearchParams(ServiceManager $sm)
     {
         return new SearchParams(
-            $sm->getServiceLocator()->get('VuFind\SearchParamsPluginManager')
+            $sm->get('VuFind\SearchParamsPluginManager')
         );
     }
 
@@ -551,9 +556,10 @@ class Factory
      */
     public static function getSearchTabs(ServiceManager $sm)
     {
+        $helpers = $sm->get('ViewHelperManager');
         return new SearchTabs(
-            $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'),
-            $sm->get('url'), $sm->getServiceLocator()->get('VuFind\SearchTabsHelper')
+            $sm->get('VuFind\SearchResultsPluginManager'),
+            $helpers->get('url'), $sm->get('VuFind\SearchTabsHelper')
         );
     }
 
@@ -566,7 +572,7 @@ class Factory
      */
     public static function getSummaries(ServiceManager $sm)
     {
-        $loader = $sm->getServiceLocator()->get('VuFind\ContentPluginManager')
+        $loader = $sm->get('VuFind\ContentPluginManager')
             ->get('summaries');
         return new ContentLoader($loader);
     }
@@ -580,7 +586,7 @@ class Factory
      */
     public static function getSyndeticsPlus(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new SyndeticsPlus(
             isset($config->Syndetics) ? $config->Syndetics : null
         );
@@ -595,7 +601,7 @@ class Factory
      */
     public static function getSystemEmail(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         return new SystemEmail(
             isset($config->Site->email) ? $config->Site->email : ''
         );
@@ -610,9 +616,9 @@ class Factory
      */
     public static function getUserList(ServiceManager $sm)
     {
-        $sessionManager = $sm->getServiceLocator()->get('VuFind\SessionManager');
+        $sessionManager = $sm->get('VuFind\SessionManager');
         $session = new \Zend\Session\Container('List', $sessionManager);
-        $capabilities = $sm->getServiceLocator()->get('VuFind\AccountCapabilities');
+        $capabilities = $sm->get('VuFind\AccountCapabilities');
         return new UserList($session, $capabilities->getListSetting());
     }
 
@@ -625,7 +631,7 @@ class Factory
      */
     public static function getUserTags(ServiceManager $sm)
     {
-        $capabilities = $sm->getServiceLocator()->get('VuFind\AccountCapabilities');
+        $capabilities = $sm->get('VuFind\AccountCapabilities');
         return new UserTags($capabilities->getTagSetting());
     }
 }
diff --git a/module/VuFindApi/src/VuFindApi/Controller/Factory.php b/module/VuFindApi/src/VuFindApi/Controller/Factory.php
index 63b697c94d7..6e46e8b199d 100644
--- a/module/VuFindApi/src/VuFindApi/Controller/Factory.php
+++ b/module/VuFindApi/src/VuFindApi/Controller/Factory.php
@@ -67,9 +67,9 @@ class Factory
      */
     public static function getSearchApiController(ServiceManager $sm)
     {
-        $recordFields = $sm->getServiceLocator()
-            ->get('VuFind\YamlReader')->get('SearchApiRecordFields.yaml');
-        $helperManager = $sm->getServiceLocator()->get('ViewHelperManager');
+        $recordFields = $sm->get('VuFind\YamlReader')
+            ->get('SearchApiRecordFields.yaml');
+        $helperManager = $sm->get('ViewHelperManager');
         $rf = new RecordFormatter($recordFields, $helperManager);
         $controller = new SearchApiController($sm, $rf, new FacetFormatter());
         return $controller;
diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/Factory.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/Factory.php
index cb03fd8d762..7f614eec17b 100644
--- a/module/VuFindTheme/src/VuFindTheme/View/Helper/Factory.php
+++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/Factory.php
@@ -51,7 +51,7 @@ class Factory
      */
     protected static function getPipelineConfig(ServiceManager $sm)
     {
-        $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
+        $config = $sm->get('VuFind\Config')->get('config');
         $default = false;
         if (isset($config['Site']['asset_pipeline'])) {
             $settings = array_map(
@@ -82,7 +82,7 @@ class Factory
     public static function getHeadLink(ServiceManager $sm)
     {
         return new HeadLink(
-            $sm->getServiceLocator()->get('VuFindTheme\ThemeInfo'),
+            $sm->get('VuFindTheme\ThemeInfo'),
             Factory::getPipelineConfig($sm)
         );
     }
@@ -97,7 +97,7 @@ class Factory
     public static function getHeadScript(ServiceManager $sm)
     {
         return new HeadScript(
-            $sm->getServiceLocator()->get('VuFindTheme\ThemeInfo'),
+            $sm->get('VuFindTheme\ThemeInfo'),
             Factory::getPipelineConfig($sm)
         );
     }
@@ -112,7 +112,7 @@ class Factory
     public static function getHeadThemeResources(ServiceManager $sm)
     {
         return new HeadThemeResources(
-            $sm->getServiceLocator()->get('VuFindTheme\ResourceContainer')
+            $sm->get('VuFindTheme\ResourceContainer')
         );
     }
 
@@ -126,7 +126,7 @@ class Factory
     public static function getImageLink(ServiceManager $sm)
     {
         return new ImageLink(
-            $sm->getServiceLocator()->get('VuFindTheme\ThemeInfo')
+            $sm->get('VuFindTheme\ThemeInfo')
         );
     }
 
@@ -140,7 +140,7 @@ class Factory
     public static function getInlineScript(ServiceManager $sm)
     {
         return new InlineScript(
-            $sm->getServiceLocator()->get('VuFindTheme\ThemeInfo'),
+            $sm->get('VuFindTheme\ThemeInfo'),
             Factory::getPipelineConfig($sm)
         );
     }
-- 
GitLab