How to use lib in laravel 5?
nullproduction opened this issue · comments
nullproduction commented
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?
Andreas Lutro commented
Import the class, read up on how namespaces work.
Questions are better asked on StackOverflow.
nullproduction commented
I use aliases, this should work without namespaces
config/app.php
'cURL' => 'anlutro\cURL\Laravel\cURL',
Andreas Lutro commented
Not if your controller is namespaced.