Welcome Guest, Not a member yet? Register   Sign In
Missing namespace from composer library
#1

(This post was last modified: 06-12-2022, 03:14 PM by MarvinKleinMusic. Edit Reason: Fixed bbcode )

Hi everyone,
I'm new to CodeIgniter and I'm testing around with it right now. According to the docs, libraries from composer should be loaded automatically.
https://codeigniter4.github.io/CodeIgnit...oader.html
I've run this composer command to add a Steam login library.
Code:
composer require vikas5914/steam-auth:1.*
However, I'll get this error:
Code:
Class "App\Controllers\Vikas5914\SteamAuth" not found

The according line in my project is the object creation from SteamAuth:

Code:
$steam = new Vikas5914\SteamAuth($config);


Do I'll need  to register the namespaces from the package somewhere? The library itself is shown within the vendor folder.

Thanks!
Reply
#2

Quote:Do I'll need  to register the namespaces from the package somewhere?

No.

PHP Code:
$steam = new \Vikas5914\SteamAuth($config); 

I recommend you learn PHP namespaces.
https://www.php.net/manual/en/language.n...ionale.php
Reply
#3

Oh... Of course, you were right. Didn't saw that it's missing the beginning /. I copied this part from the example readme of the libary itself.

Thanks for pointing it out to me.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB