codeigniter - PHP namespace error -


i have problem php api library supposed work. using codeigniter framework.

i trying use phpevecentral library eve_market_model. can see library composed of several files using namespaces. use library, have include main file phpevecentral.

here, can find screenshot of arborescence folders.

http://s21.postimg.org/byz3udi8n/arbo.png

namespace phpevecentral;  class phpevecentral {     ...      public function marketstat($typeid = array())     {         return new \phpevecentral\requests\marketstat($typeid);     } } 

so, when call phpevecentral->marketstat() function, php error :

class 'phpevecentral\requests\marketstat' not found in c:\wamp\www\eve-board\application\libraries\phpevecentral\phpevecentral.php on line 68 

when include phpevecentral\requests\marketstat.php file, there not error anymore have other error other file, have include , on.

do have manually include each file of library? hope there other way because it's bit boring.

thanks help.

edit

i extended codeigniter loader class adding method recursivly include file of folder. https://github.com/zallek/codeigniter/blob/master/my_loader.php

using method, don't error , that's works. problem optimization problem :

the load->file() include file php vanilla while load->class() design instanciate once class (singleton). can't use load->class() because there interfaces not work method. maybe, should find way detect if it's class file or interface file ...

what want set called auto loading. if name files correctly load them needed.

there's standard called psr-0, can read about @ https://github.com/php-fig/fig-standards/blob/master/accepted/psr-0.md

you have sample implementation there.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -