Class not found
<p>I got the following error during I call the class (in image file)
<a href="http://i.stack.imgur.com/7soSg.png" rel="nofollow">enter image description here</a></p>

<p>The following is the page I getting error. I'm trying to call the class from models/toSession.php . </p>

<pre><code>&lt;?php
session_start();
error_reporting(E_ALL^E_NOTICE);

use myGuzzle\myGuzzle;
use models\toSession;
spl_autoload_register(function ($class_name) {
    include $class_name . '.php';
});
session_start();
error_reporting(E_ALL^E_NOTICE);
$login = $_POST['login'];
$pass = $_POST['pass'];

$myGuzzle = new myGuzzle();
$myGuzzle-&gt;response(['login'=&gt;$login,'pass'=&gt;$pass,'rememberme'=&gt;''],'POST','api.hitbox.tv/auth/login');

if($myGuzzle-&gt;getStatus() == 200){

    $json = json_decode($myGuzzle-&gt;getBody(),true);
    $toSession = new toSession();

   if($toSession-&gt;toSession($json)){
     $_SESSION['msg'] = "Login Success";
   }

}
else if($myGuzzle-&gt;getStatus() == 400){

    $_SESSION['msg'] = "Fail to login due to invalid id or password. ".$myGuzzle-&gt;getBody();

}
else{

     $_SESSION['msg'] = $myGuzzle-&gt;getBody();
    }



?&gt;
</code></pre>

<p>Following is the class I wanted to call. I'm trying to turn the array to session.</p>

<pre><code>&lt;?php;
namespace models;
session_start();
error_reporting(E_ALL^E_NOTICE);

class toSession{

    public $opts;

    function turnToSession($opts = []){

        $this-&gt;opts = $opts;
        return proceed();

    }
    function  proceed(){

        foreach($this-&gt;opts as $key=&gt;$value){

            $_SESSION[$key]=$value;

        }

        return true;
    }


}
</code></pre>