I can not mount autoload with PSR-4 for multiple folders and subfolders

0

I'm trying to pass a project to MVC and then created the following structure:

   
pasta_projeto
-App
--Controllers
---Classes
--Models
---Classes
--views
---html
-vendor
--Controller
---Action.php
--init
---Bootrstrap.php

I am creating the file composer.json within the folder of my project with the following structure:

{
    "name" : "pasta/projeto",
    "require" : {
        "php" : ">=5.3" 
    },
    "minimum-stability" : "alpha",
    "authors" : [
        {
            "name" : "autor",
            "email" : "[email protected]"
        }
    ],
    "autoload": {
        "psr-4": {
            "[Nome da pasta em vendor]\":"vendor/[Nome da Pasta em vendor]",
            "App\": "App/"

        }
    },
    "config" : {
        "bin-dir" : "bin"
    }
    }

Running the command on composer dump-autoload -o (on terminal) to load autoload , my classes when created are with namespace :

namespace App\[Pasta da Classe];
namespace [Nome da pasta em vendor]\[Pasta da Classe]

When you use them:

use App\[Pasta da Classe]\[Nome da classe];
use [Nome da pasta em vendor]\[Pasta da Classe];
The problem is that PHP does not find the classes that are in the vendor folder, only the classes in the App
PHP Fatal error:  Class 'nomedapastaemvendor\init\Bootstrap' not found
in C:\Users\vinic\Desktop\pasta_projeto\App\Init.php on line 8        
[Tue Mar 20 12:46:38 2018] ::1:62311 [500]: / - Class
'nomedapastaemvendor\init\Bootstrap' not found in
C:\Users\vinic\Desktop\pasta_projeto\App\Init.php on line 8
    
asked by anonymous 20.03.2018 / 16:53

0 answers