How to fix the error below using the composer.
composer.json code already created in bin \:
{
"require": {
"slim/slim": "2.*"
}
}
As discussed in this question in the SOen and in this issue in the official Composer repository, the error is generated due to an incompatibility generated in Windows when the COMPOSER
environment variable is defined. The practical solution is to access the environment variables and remove it, not forgetting to restart the computer after the process. This should work normally.
Installation
Create a folder in your xampp with any name and then navigate the cmd to it:
cd c:\xampp\htdocs\NomeDaPasta
Installation with Composer
Install the composer in your project
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
Then in cmd yet:
echo @php "%~dp0composer.phar" %*>composer.bat
create composer.json in the folder:
{
"require": {
"slim/slim": "2.*"
}
}
After this use the command:
php composer.phar install
Create index.php:
<?php
require 'vendor/autoload.php';