Composer autoload can't find class

Viewed 7923

I'm trying to create a MVC structure and use composer to autoload everything.
But I keep getting this error:

Fatal error: Uncaught Error: Class 'App\Init' not found in C:\wamp64\www\activity\Public\index.php on line 5

|MainFolder  
    |App  
    |Public  
    |Vendor  
        |ACT  
        |composer  
        |autoload.php  
    |composer.json  

composer.json:

{
    "name": "vendor/activity",
    "description": "descrip",

    "require": {
        "php": ">=5.6.25"
    },

    "authors":[
        {
            "name": "John Doe",
            "email": "johndoe@gmail.com"
        }
    ],

    "autoload":{
        "psr-4": {
            "ACT\\": "vendor/",
            "App\\": "/"
        }
    },
    "config":{
        "bin-dir": "bin"
    }
}

App\init.php

<?php    
namespace App;

class Init
{
    public function __construct()
    {
        echo "Loaded!!";
    }
}

Public\index.php

<?php
require_once '../vendor/autoload.php';

$init = new \App\Init;  

\Vendor\composer\autoload_namespaces.php

<?php    

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    "ACT" => array($vendorDir . false),
    "App" => array($baseDir . '/'),
);  

Obs: Already did composer dump-autoload

1 Answers
Related