V
V
v- death2016-01-06 05:50:39
PHP
v- death, 2016-01-06 05:50:39

How does psr-4 download work?

Hello. In composer.json

{
    "autoload": {
        "psr-4": { 
            "App\\" : "app/"
        }
    }
}

Project structure
4945ae974249436fb98e2f7eff10a2f9.png
Trying to access the index class app/kontrollers/index.php
require_once '../vendor/autoload.php';
$index = new \App\Kontrollers\index();
$index->in();

I get an error
Fatal error: Class 'App\Kontrollers\index' not found in /home/v-smerti/projekt/star_labs/api/public/index.php on line 5

Index class code
namespace \App\Kontrollers\index;
class index {
    public function in() {
        echo'0789078907890';  
    }
}

What did I do wrong? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Masterov, 2016-01-06
@vGrabko99

1. namespace App\Kontrollers;
2. composer update -a

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question