php - using Symfony class loader -
recently, i'm diving symfony's class loader component. however, need solve issue. have following folder structure;
-> project -> public -> index.php -> package -> request.php
in index.php
i'm using following statements load class loader of symfony;
define ('root', dirname(dirname(__file__))); $paths = array( 'system' => root . '/package' ); $namespaces = array( 'mynamespace' => $paths['system'] ); require $paths['vendor'] . '/symfony/class-loader/symfony/component/classloader/universalclassloader.php'; use symfony\component\classloader\universalclassloader; $autoload = new universalclassloader(); $autoload->registernamespaces($namespaces); $autoload->register(); use mynamespace\request; request::create();
in request.php
, have following code;
namespace mynamespace; class request { static public function create() { } }
however, in index.php file, says request class can't found
so, doing wrong here ? ideas ?
Comments
Post a Comment