我曾尝试在app/
中使用自定义文件夹存储帮助程序,例外,存储库等等。我尝试按照测试...
目录结构
app
-iw
-Billing
-BillingInterface.php
-StripeBilling.php
-Exceptions
-Repositories
-macros.php
我甚至在composer.json文件中添加了以下内容并运行了命令composer dump
"psr-0": {
"iw" : "app/"
}
为测试目的而创建的类......
// 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');
}
}
当我尝试跟随...
(new iw\Billing\StripeBilling)->bill();
我得到Class 'iw\Billing\StripeBilling' not found
请帮我解决这个问题。感谢