I use composer in windows and it successfully loads my 2 packages, which I use from my composer.json file when I execute composer install
or composer update
.
{
"require": {
"bcosca/fatfree": "dev-master",
"respect/validation": "^1.1"
}
}
First line in my index.php
require_once __DIR__ . '\vendor\autoload.php';
It seems that nothing was loading, for example, there were a lot of errors related to classes not defined from these 2 packages. I looked through it further and found that mine autoload_namespaces.php
looked like this:
<?php
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
The array is completely empty, how does this happen? I expected to see these requirements for two packages here ...
Thanks for the help!
Adding the .json composer from the packages themselves: F3:
{
"name": "bcosca/fatfree",
"description": "A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!",
"homepage": "http://fatfreeframework.com/",
"license": "GPL-3.0",
"require": {
"php": ">=5.3.6"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/bcosca/fatfree"
}
],
"autoload": {
"files": ["lib/base.php"]
}
}
Validator:
{
"name": "respect/validation",
"description": "The most awesome validation engine ever created for PHP",
"keywords": ["respect", "validation", "validator"],
"type": "library",
"homepage": "http://respect.imtqy.com/Validation/",
"license": "BSD Style",
"authors": [
{
"name": "Respect/Validation Contributors",
"homepage": "https://github.com/Respect/Validation/graphs/contributors"
}
],
"require": {
"php": ">=5.4",
"symfony/polyfill-mbstring": "^1.2"
},
"require-dev": {
"egulias/email-validator": "~1.2",
"malkusch/bav": "~1.0",
"mikey179/vfsStream": "^1.5",
"phpunit/phpunit": "~4.0",
"symfony/validator": "~2.6.9",
"zendframework/zend-validator": "~2.3"
},
"suggest": {
"ext-bcmath": "Arbitrary Precision Mathematics",
"ext-mbstring": "Multibyte String Functions",
"egulias/email-validator": "Strict (RFC compliant) email validation",
"malkusch/bav": "German bank account validation",
"symfony/validator": "Use Symfony validator through Respect\\Validation",
"zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation",
"fabpot/php-cs-fixer": "Fix PSR2 and other coding style issues"
},
"autoload": {
"psr-4": {
"Respect\\Validation\\": "library/"
}
},
"autoload-dev": {
"psr-4": {
"Respect\\Validation\\": "tests/library/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"scripts": {
"test": "./vendor/bin/phpunit"
}
}
And after downloading Validator, this Symfony component came with it:
{
"name": "symfony/polyfill-mbstring",
"type": "library",
"description": "Symfony polyfill for the Mbstring extension",
"keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=5.3.3"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" },
"files": [ "bootstrap.php" ]
},
"suggest": {
"ext-mbstring": "For best performance"
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
}
}