3

I'm using Blackfire to profile my Laravel app.

I'm getting a message:

You should dump optimized Composer autoloader

metrics.composer.autoload.find_file.count 7 == 0

I ran:

composer dump-autoload -o 

But I still get this message

Am I missing something? Is there another operation I should do?

Juliatzin
  • 18,455
  • 40
  • 166
  • 325

1 Answers1

2

It means that not all classes used in the application are added to autoloader's class map which is just a big array - 'className' => 'path/To/class' located in vendor/composer/autoload_classmap.php.

That's how to fix it:

First you need to find out which classes are missing. You can add this: var_dump($class); right after

if (isset($this->classMap[$class])) {
    return $this->classMap[$class];
}

in vendor/composer/ClassLoader.php, and next time when you will run your app, you will see which classes are not in the class map. Then you can edit your composer.json and add path to those classes like this:

"autoload": {
    "classmap": [
        "path/to/myClasses/",
    ]
}

when this is done you can run composer dump-autoload -o. It should fix the problem.

RB_
  • 1,195
  • 15
  • 35