mardi 29 août 2017

include class with autoload.php but getting class not found error

I tried to use jasonmapper just as written in manual. I required autoload.php file, and when construct JasonMapper object, i go class not found exception.

(1/1) FatalThrowableError Class 'App\Http\Controllers\JsonMapper' not found

Here is my code

namespace App\Http\Controllers;

require __dir__.'/../../../vendor/autoload.php';
use Illuminate\Http\Request;
use App\Http\Games\Numbers;

class ApiController extends Controller
{
    public function home()
    {
        $client = new \GuzzleHttp\Client();
        $res = $client->request(
          'GET',
          $testurl
        );
        $json = json_decode($res->getBody());
        $mapper = new JsonMapper();// error occurs at this line
        $numbers = $mapper->map($json, new Numbers());
        return json_encode($numbers);
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire