Composer autoload-dev does not work

The file autoload_psr4.php not contains the namespace from “autoload-dev” section only from “autoload” section.

When my composer.json reads

"autoload": {
    "psr-4": {
        "Namespace\\": "src/"
"autoload-dev": {
    "prs-4": {
        "Namespace\\Tests\\": "tests/"

And I run

composer require vendor/namespace 1.0-dev

My /vendor/composer/autoload_prs4.php file appears as

// autoload_psr4.php @generated by Composer

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

return array(
    'Namespace\\' => array($baseDir . '/src'),


  • Text version-control in PHP with difference highlight
  • PHP: shell_exec git pull pass passphrase
  • Set up a github repository for an existing LAMP set up
  • How to use git with Symfony 2?
  • Git - Exclude a config file from post-receive checkout
  • Error when trying to clear cache with a Symfony2 project
  • Test and Debug Composer plugins
  • Repository deployment and Composer : what workflow?
  • One Solution collect form web for “Composer autoload-dev does not work”

    My guess is that you’re showing the composer.json of vendor/namespace package. If that’s the case:

    Take a look at the docs. It says: “autoload-dev (root only)”. root only means it only applies to the root package. As you included the package, the shown composer.json file is not the root package and the autoload-dev section is thus ignored.

    Git Baby is a git and github fan, let's start git clone.