Composer Autoload Multiple Files in Folder

后端 未结 2 970
醉梦人生
醉梦人生 2021-02-07 01:54

I\'m using composer in my latest project and mapping my function like this

\"require\": {
    ...
},
\"require-dev\": {
    ...
},
\"autoload\": {
    \"psr-4\":         


        
2条回答
  •  我寻月下人不归
    2021-02-07 02:13

    There's actually a better way to do this now without any custom code. You can use Composer's classmap feature if you're working with classes. If you're working with individual files that contain functions then you will have to use the files[] array.

    {
        "autoload": {
            "classmap": ["src/", "lib/", "Something.php"]
        }
    }
    

提交回复
热议问题