diff --git a/ClientFactory/AutoDiscoveryFactory.php b/ClientFactory/AutoDiscoveryFactory.php
new file mode 100644
index 00000000..78b64f78
--- /dev/null
+++ b/ClientFactory/AutoDiscoveryFactory.php
@@ -0,0 +1,21 @@
+
+ */
+class AutoDiscoveryFactory implements ClientFactory
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function createClient(array $config = [])
+ {
+ return HttpClientDiscovery::find();
+ }
+}
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 00ebe74f..6f9f5aea 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -173,9 +173,15 @@ private function configureClients(ArrayNodeDefinition $root)
})
->thenInvalid('A http client can\'t be decorated with several of FlexibleHttpClient, HttpMethodsClient and BatchClient. Only one of the following options can be true. ("flexible_client", "http_methods_client", "batch_client")')
->end()
+ ->validate()
+ ->ifTrue(function ($config) {
+ return $config['factory'] === 'httplug.factory.auto' && !empty($config['config']);
+ })
+ ->thenInvalid('If you want to use the "config" key you must also specify a valid "factory".')
+ ->end()
->children()
->scalarNode('factory')
- ->isRequired()
+ ->defaultValue('httplug.factory.auto')
->cannotBeEmpty()
->info('The service id of a factory to use when creating the adapter.')
->end()
diff --git a/Resources/config/data-collector.xml b/Resources/config/data-collector.xml
index 98b177de..0cfcb868 100644
--- a/Resources/config/data-collector.xml
+++ b/Resources/config/data-collector.xml
@@ -27,6 +27,12 @@
+
+
+
+
+
+
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 1e39f74f..c9b4df13 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -12,6 +12,9 @@
+
+
+