diff --git a/src/PIBadRequestException.php b/src/PIBadRequestException.php
index c121ab8e7183e4345c05e34a8e3d73c2e7b3edbb..f042d16e2f2422a903e0793da75a9420a341d552 100644
--- a/src/PIBadRequestException.php
+++ b/src/PIBadRequestException.php
@@ -1,5 +1,7 @@
 <?php
 
+namespace PrivacyIdea\PHPClient;
+
 class PIBadRequestException extends \Exception {}
 {
 
diff --git a/src/PIChallenge.php b/src/PIChallenge.php
index b499d40ebf44f554476c5c3c2a313668ea14063e..14f294ebeb71220bfe82a984337f57e7ae2c2d3f 100644
--- a/src/PIChallenge.php
+++ b/src/PIChallenge.php
@@ -1,5 +1,7 @@
 <?php
 
+namespace PrivacyIdea\PHPClient;
+
 class PIChallenge
 {
     /* @var string Token's type. */
diff --git a/src/PILog.php b/src/PILog.php
index 1b2daa33120a560e3dca0ad7d1c35eb48df7f035..1809fb2fa0aa379dddfa0c471e32a1a7fdbc4896 100644
--- a/src/PILog.php
+++ b/src/PILog.php
@@ -1,5 +1,7 @@
 <?php
 
+namespace PrivacyIdea\PHPClient;
+
 /**
  * Interface PILog
  * Call the functions that collect debug and error messages
diff --git a/src/PIResponse.php b/src/PIResponse.php
index fb11e0b6e76bdb36c118ebff873929761e6e28b4..39f4728ce2ccea6e9d58ae24f01d92dd0c09ba45 100644
--- a/src/PIResponse.php
+++ b/src/PIResponse.php
@@ -1,5 +1,7 @@
 <?php
 
+namespace PrivacyIdea\PHPClient;
+
 class PIResponse
 {
     /* @var string All tokens messages which are sent by PI and can be used in UI to help user interact with service. */
diff --git a/src/PrivacyIDEA.php b/src/PrivacyIDEA.php
index 3d74935b59fee3c29bd378a455a0e477bb98f2fd..6c4b868198ce0d7c44a3aa74a248653c3ed3493d 100644
--- a/src/PrivacyIDEA.php
+++ b/src/PrivacyIDEA.php
@@ -1,4 +1,7 @@
 <?php
+
+namespace PrivacyIdea\PHPClient;
+
 const AUTHENTICATORDATA = "authenticatordata";
 const CLIENTDATA = "clientdata";
 const SIGNATUREDATA = "signaturedata";
diff --git a/src/SDK-Autoloader.php b/src/SDK-Autoloader.php
index f047cdfc839fe94b48b0cf6c1e05fc1de3337a5b..37b95f39a4d5c925e8e7405a09d5a76b5743ea95 100644
--- a/src/SDK-Autoloader.php
+++ b/src/SDK-Autoloader.php
@@ -9,10 +9,13 @@ spl_autoload_register('autoLoader');
 
 function autoLoader($className)
 {
-    $fullPath = dirname(__FILE__) . "/" . $className . ".php";
+    $classNameParts = explode("\\");
+    $classNameOnly = $classNameParts[count($classNameParts) - 1];
+    $fullPath = dirname(__FILE__) . "/" . $classNameOnly . ".php";
     if (file_exists($fullPath))
     {
         require_once $fullPath;
+        class_alias($className, $classNameOnly, false);
         return true;
     } else
     {