I could not get answer to this question anywhere, and it is no wonder. You have sort know a little about how composer works under the hood so to speak because you have to be explicit in telling composer what you want it to do. I would therefore suggest reading the documentation here well.
Next, if you have other packages already installed, look at the vendor/composer/installed.json file. This will give you an idea of what composer is looking for when it adds a namespace to the classmap.
I am developing a laravel package, I wanted to import a repo without using packagist, and I got stuck on this for while. I eventually got it work and this is what I have.
"repositories": [
{
"type": "package",
"package": {
"name": "example/package",
"version": "0.1.0",
"dist": {
"url": "https://github.org/name/package/src/master",
"type": "git"
},
"source": {
"url": "https://github.org/name/package",
"type": "git",
"reference": "master"
},
"autoload": {
"psr-4": {
"Example\\Package\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Example\\Package\\ExamplePackageProvider"
]
}
}
}
}
],
"require": {
"exmaple\package": "0.1.0"
}
Run composer install
Check /vendor/composer/installed.json and it should show...
{
"name": "exmaple\package",
"version": "0.1.0",
"version_normalized": "0.1.0.0",
"source": {
"type": "git",
"url": "https://github.org/name/package/src/master",
"reference": "master"
},
"dist": {
"type": "git",
"url": "https://github.org/name/package"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Example\\Package\\ExamplePackageProvider"
]
}
},
"installation-source": "source",
"autoload": {
"psr-4": {
"Example\\Package\\": "src/"
}
},
"install-path": "../exmaple/package"
}
Then check vendor/autoload_classmap.php and you should see the namespaces.
Now if you commit and push on your package repo and want update the package in your test repo you need to change the version.
...
"package": {
"name": "example/package",
"version": "0.2.0",
"dist":
...
Then run composer update example/package