我正在使用一个自定义文件夹中的应用程序目录,其中包含帐单,例外,存储库等。这是我的目录结构…
app
-iw
-Billing
-BillingInterface.php
-StripeBilling.php
-Exceptions
-Repositories
-macros.phpcomposer.json
"psr-4": {
"iw\\" : "app/iw"
},ran命令composer dump-autoload -o
类
// app/iw/BillingInterface.php (location)
<?php namespace iw\Billing;
interface BillingInterface {}和
// app/iw/StripeBilling.php (location)
<?php namespace iw\Billing;
class StripeBilling {
public function bill()
{
dd('billing');
}
}我收到类找不到错误,甚至我注意到vendor/composer/autoload_ps4.php没有用这个新文件夹更新。请帮帮忙。谢谢
发布于 2014-09-11 19:35:42
在classmap中添加"app/iw“。
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/iw"
],
"psr-4" : {
"iw\\" : "app/iw"
}
}然后运行
composer dump-autoload -o发布于 2014-04-05 08:43:39
我尝试了这个json文件,它工作了.
"autoload": {
"psr-4": {"iw\\" : "app/iw" },
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
}但请建议在自动加载部分添加"psr-4": {"iw\\" : "app/iw" }后它为什么会起作用。
https://stackoverflow.com/questions/22869312
复制相似问题