Laravel 4: loading an old library: how?

≡放荡痞女 提交于 2019-12-03 14:18:58

You can create a libraries directory just like in laravel 3 and include it in your class loader. You can do this via composer or laravel.

//composer.json
"autoload": {
    "classmap": [
        "app/commands",
        "app/libraries",
        "app/database/migrations",
        "app/tests/TestCase.php",
    ]
},

//app/starts/global.php
ClassLoader::register(new ClassLoader(array(
    app_path().'/libraries',
)));

Autoloading via Laravel does not require you to run "composer dumpautoload" every time a class is created or removed.

UPDATE - L4 Beta 4

ClassLoader::addDirectories(array(
    app_path().'/libraries',
));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!