找不到psr-4类

时间:2016-02-07 18:07:41

标签: php psr-4

我尝试使用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"
        }
    }
}

我做错了什么?

0 个答案:

没有答案