anlutro / php-curl

Simple PHP curl wrapper class

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use lib in laravel 5?

nullproduction opened this issue · comments

Code in my controller:

public function index()
 {
        $response = cURL::get('http://www.google.com');
        dd($response);
        return view('home');
}

Error:

at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Class 'App\Http\Controllers\cURL' not found', 'file' => '/Users/mezhevikin/Desktop/PublicusServer/app/Http/Controllers/HomeController.php', 'line' => '33')) in HandleExceptions.php line 116
at HandleExceptions->handleShutdown()

How to use lib in laravel 5?

Import the class, read up on how namespaces work.

Questions are better asked on StackOverflow.

I use aliases, this should work without namespaces

config/app.php

'cURL' => 'anlutro\cURL\Laravel\cURL',

Not if your controller is namespaced.