我尝试使用psr-4设置我的第一个项目,但收到以下错误:
致命错误:未捕获错误:类' leaseregistratie \存储库' 找不到/home/vagrant/Code/testomgeving/index.php:7堆栈跟踪:
在第7行的/home/vagrant/Code/testomgeving/index.php中抛出0 {main}
我的文件夹结构:
testomgeving has (psr4,composer.json,index.php,vendor)
psr4 (start.php)
app
leaseregistratie
Repositories (UserRepository.php)
的index.php:
<?php
use leaseregistratie\Repositories\UserRepository as user;
require_once 'psr4/start.php';
$user = new user();
?>
start.php:
<?php
require_once '/../vendor/autoload.php';
UserRepository:
<?php
namespace leaseregistratie\Repositories;
class UserRepository {
public function __construct()
{
die('user!');
}
}
Composer.json:
{
"autoload": {
"psr-4": {
"leaseregistratie\\": "app/leaseregistratie"
}
}
}
我做错了什么?