Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mx888's avatar
Level 1

Adding custom class with "use" of laravel class

Hi,

I have added a new class to app\custom folder called Test;

The class looks like this:

namespace App\Custom;
use Curl\Curl;

class Test
{
}

The class will use Curl library.

Now when i call the class from controller, i get error "Class 'App\Curl' not found".

How to solve this, so i can use this curl class inside custom class of mine?

0 likes
6 replies
ianlucas's avatar

Maybe this is happening because you're using slash instead of backslash, so it should be use Curl\Curl; (assuming you installed the Curl library correctly on Composer).

mx888's avatar
Level 1

Hmm.. thanks for reply, but i typed it incorrectly on forum :)

I'm using "use Curl\Curl;" and still same error. I think it's somehow related to namespace.

vin's avatar

not sure if that's the issue but is the namespace 'app' or 'App' ?

mx888's avatar
mx888
OP
Best Answer
Level 1

Solved... The curl class just wasn't downloaded by composer. I had to require it.

Never code at night.

Please or to participate in this conversation.