A
A
Archakov Dennis2016-07-17 19:59:19
PHP
Archakov Dennis, 2016-07-17 19:59:19

Why is Composer Autoload not loading classes?

I started working with Composer and refactored my project. Decided to load my classes via autoload. The composer.json has this code:

{
   "require": {
      "guzzlehttp/guzzle": "~6.0"
   },
   "autoload": {
   		"psr-4": {
   			"App\\Classes\\": "App/Classes"
   		}
   }
}

There is an InstagramClass.php file in the App/Classes folder :
<?php 

use GuzzleHttp\Client;
use GuzzleHttp\Stream\Stream;

namespace App\Classes;

class Instagram {
....

In index.php :
<?php 
  
  //ini_set('display_errors',1);
  require 'vendor/autoload.php';

  $Instagram = new App\Classes\Instagram('270534082.1e03566.c8abaeb7073349a8a146716dbf79c65d');

?>

Gives the following error:
Fatal error: Class 'App\Classes\Instagram' not found in index.php on line 6

Fulfilled of course commands: composer install, composer dump-autoload
What's the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Archakov Dennis, 2016-07-17
@archakov06

Solved a problem. It was necessary to replace the file name with a reversible class.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question