Loading namespaced classes with Symfony 1.4's autoloader?

后端 未结 3 1491
独厮守ぢ
独厮守ぢ 2021-02-03 13:07

How to register namespaces (with PHP 5.3) in the Symfony 1.4 for the autoloader class feature (like the Symfony 2.0)?

3条回答
  •  余生分开走
    2021-02-03 13:50

    You can use Composer and it's very easy. Just install it on your machine (you probably have already since it's 2015 now) and run in your project folder:

    composer init 
    

    You can then install all the packages you want with composer and include just this line in your ProjectConfiguration.class.php:

    require_once __DIR__.'/../vendor/autoload.php';
    

    Note that paths may differ if you changed the default Symfony1.4 directory structure.

提交回复
热议问题