I've got the following composer.json
file:
{
"require-dev": {
"queueit/KnownUser.V3.PHP": "dev-master"
},
"repositories": [
{
"type": "package",
"package": {
"name": "queueit/KnownUser.V3.PHP",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/kenorb-contrib/KnownUser.V3.PHP.git",
"reference": "task/composer-autoloader"
}
}
}
]
}
However upon running composer install
, the namespaces or classes aren't added into autoload_classmap.php
or autoload_namespaces.php
in vendor/composer
.
Before that I've added into project's composer.json
these lines:
"autoload": {
"psr-4": {
"QueueIT\\": ""
}
}
in order to scan for the class/namespaces within the current folder and the file looks like:
$ cat vendor/queueit/KnownUser.V3.PHP/composer.json
{
"name": "queueit/knownuserv3",
"description": "The Queue-it Security Framework is used to ensure that end users cannot bypass the queue by adding a server-side integration to your server.",
"require": {
"php": ">=5.3.3"
},
"license":"LGPL-3.0",
"autoload": {
"psr-4": {
"QueueIT\\": ""
}
}
}
Executing dump-autoload
manually doesn't take any effect as well as follow:
$ composer dump-autoload -o
Generating optimized autoload files
$ grep -R QueueIT vendor/composer/
(no results)
To confirm that's the case, here is the shell command to test it:
$ php -r 'require __DIR__ . "/vendor/autoload.php"; use QueueIT\KnownUserV3\SDK\KnownUser; new KnownUser;'
Fatal error: Uncaught Error: Class 'QueueIT\KnownUserV3\SDK\KnownUser' not found in Command line code:1
However the classmap is generated when executing composer dump-autoload -o
directly in the project folder it-self (within vendor/queueit/KnownUser.V3.PHP/
folder).
Why my autoload definition in project's composer.json
doesn't take any effect when run from the top folder?