6
Installing Composer in windows has given me some work. I have some doubts:
The Composer installer on Windows asks to inform the location of php.exe
, and settle in there.
After that I ran the commands on my console composer.json
is like this:
{
"require": {
"guzzlehttp/guzzle": "~5.2"
}
}
The composer.Lock
and the autoload.php
were created after installation everything correct.
When using in my file if I indicate :
require_once 'vendor/autoload.php';
It will not work because the vendor folder is in C:\XAMPP\PHP
and the project in C:\XAMPP\HTDOCS\Site
.
I tried to indicate in require the full vendor path (C:\XAMPP\PHP\Vendor\autoload.php
) didn’t work either.
Does anyone know where I am going wrong? If it is otherwise that informs where the autoload is?
Have you tried putting the directory where Composer and PHP are in your environment variable
PATH
? So you can call them anywhere.– bfavaretto
The archive
composer.json
must be in the root folder of your project (C: XAMPP HTDOCS Site)– Lucio Rubens
@luciorubenns Then I think there’s something wrong,
– Rodolfo Oliveira
When rotating
composer update
in the project folder, which output?– Lucio Rubens
@luciorubeens Loading Composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files
– Rodolfo Oliveira
The briefcase
vendor
and the filecomposer.lock
were also generated in the project folder?– Lucio Rubens
@luciorubeens Positivo
– Rodolfo Oliveira
@Rodolfooliveira As mentioned, you should always use Composer install/update in your project folder, just as the Composer.json file should be there as well. And how are you able to use Composer and autoload?
– Rafael Withoeft