CodeIgniter Forums
Load a full folder library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Load a full folder library (/showthread.php?tid=58945)



Load a full folder library - El Forum - 08-07-2013

[eluser]Unknown[/eluser]
I have a problem with a PHP API library which is supposed to work.

I am trying to use the PHPEVECentral library from my eve_market_model. As you can see the library is composed of several files using namespaces. To use the library, i have just include the main file PHPEVECentral.

Here, you can find a screenshot of the arborescence folders.


Code:
namespace PHPEveCentral;
    
    class PHPEveCentral
    {
        ...
    
        public function MarketStat($typeid = array())
        {
            return new \PHPEveCentral\Requests\MarketStat($typeid);
        }
    }

So, when i call PHPEveCentral->MarketStat() function, I get a php error :

Code:
Class 'PHPEveCentral\Requests\MarketStat' not found in C:\wamp\www\Eve-board\application\libraries\PHPEveCentral\PHPEveCentral.php on line 68

When I include the PHPEveCentral\Requests\MarketStat.php file, there is not this error anymore but then i have an other error for an other file, so i have to include it too and so on.

Do I have to manually include each file of the library? I hope there is an other way because it's a bit boring.
Maybe using a extended Loader class, but I didn't find anyfind on Google.

One other thing : some of this library files are Interface. So I can't use load->library() on them ...

Thanks you for your help.