Skip to content
Advertisement

composer does not generate autoload.php

i install composer for windows using this link http://getcomposer.org/download/ > http://getcomposer.org/Composer-Setup.exe

my web server is WAMP php 5.4 with openssl enabled.

i created composer.json with this code

{
    "require": {
        "doctrine/orm": "*"
    }
}

and run with this code in .php file

<?php
// bootstrap.php
// Include Composer Autoload (relative to project root).
require_once "vendor/autoload.php";

and i got error Warning: require_once(vendor/autoload.php): failed to open stream

how to get composer’s autoload.php?

why composer does not generate it?

how to use doctrine without composer?

Advertisement

Answer

Did you actually look to see if a vendor/autoload.php was created?

Did composer throw any error messages? Unless you got an error then I’m willing to bet that a vendor/autoload files was made. Is there anything in vendor?

I’m guessing that your bootstrap.php is not in your root directory (same directory as composer.json). If so you need to adjust the path in your require statement.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement