CodeIgniter Forums
Class not found when loading a library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Class not found when loading a library (/showthread.php?tid=78820)



Class not found when loading a library - fedeburo - 03-15-2021

Hi, I have some libraries created under a subdirectory inside Library folder:

../app/Libraries/commonLibraries/

Inside this folder, i have 10 different libraries that i will use in a lot of parts of the web application.

The problem is that inside a library y may have different classes, and i would like to initialize this classes (the classes names are different of the file name)

Example:

I have a library that is: /app/Libraries/commonLibraries/FileDoSomething.php

Inside this library, i have a class defined that is :

class anythingToDo{
...
}


How can i create an object anythingToDo in another part of the project that is not in the FileDoSomething?




RE: Class not found when loading a library - iRedds - 03-15-2021

Look at Classmap

But I think this is bad design.

Everything will be fine as long as you remember what is where.


RE: Class not found when loading a library - Kaosweaver - 03-22-2021

(03-15-2021, 05:25 AM)fedeburo Wrote: Inside this library, i have a class defined that is :

class anythingToDo{
...
}[/font][/size][/color]

How can i create an object anythingToDo in another part of the project that is not in the FileDoSomething?


Have you tried:

PHP Code:
$todo = new anythingToDo(); 
as long as the FileDoSomething is included, that should work, right?


RE: Class not found when loading a library - fedeburo - 03-23-2021

(03-22-2021, 08:37 AM)Kaosweaver Wrote:
(03-15-2021, 05:25 AM)fedeburo Wrote: Inside this library, i have a class defined that is :

class anythingToDo{
...
}[/font][/size][/color]

How can i create an object anythingToDo in another part of the project that is not in the FileDoSomething?


Have you tried:

PHP Code:
$todo = new anythingToDo(); 
as long as the FileDoSomething is included, that should work, right?
This is not working. The vs code catches the class, but when executing the function in the explorer says class not found


RE: Class not found when loading a library - InsiteFX - 04-01-2021

PHP Code:
$todo = new App\Libraries\commonLibraries\FileDoSomething();