Reputation: 3468
I'm trying to setup a project using private Bitbucket repositories. The application includes the core and the core will subsequently include others. The application should be able to include more in the future.
Now, I use this at work with Satis, though for myself I want to just use Bitbucket, as I think that should work. I've followed the Set up SSH for Git of Bitbucket and read the manual of Composer on Git alternatives.
I've been trying a lot of variations on the settings, but cannot work it out.
My projects composer.json
"require": {
"php": "^5.6 || ^7.0",
"rkeet/yc-core": "*"
},
"repositories": [
{
"type": "git",
"url": "[email protected]:rkeet/yc-core.git"
}
],
"autoload": {
"psr-4": {
"Application\\": "module/Application/src/"
}
}
The YC-core composer.json
"name": "rkeet/yc-core",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^5.6 || ^7.0",
"zendframework/zendframework": "2.5.*",
"doctrine/doctrine-module": "~1.0",
"doctrine/orm": "v2.5.*",
"rwoverdijk/assetmanager": "1.*",
"rkeet/yc-account": "*"
},
"require-dev": {
"ghislainf/zf2-whoops": "dev-master"
},
"repositories": [
{
"type": "git",
"url": "[email protected]:rkeet/yc-account.git"
}
],
"autoload": {
"psr-4": {
"YC\\Core\\": "src/"
},
"classmap": [
"./Module.php"
]
}
And lastly, the yc-account composer.json
"name": "rkeet/yc-account",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^5.6 || ^7.0",
"bjyoungblood/bjy-authorize": "~1.4",
"zf-commons/zfc-user-doctrine-orm": "~1.0",
"rkeet/yc-core": "*"
},
"repositories": [
{
"type": "git",
"url": "[email protected]:rkeet/yc-core.git"
}
],
"autoload": {
"psr-4": {
"YC\\Account\\": "src/"
},
"classmap": [
"./Module.php"
]
}
There are some other vars in the composer objects not relevant to the repositories, such as description
, type
, authors
, et cetera, I've omitted those for the possibly relevant.
Result I receive when using composer update
command is the following:
?[37;41mYour requirements could not be resolved to an installable set of packages.?[39;49m
Problem 1
- rkeet/yc-core dev-develop requires rkeet/yc-account * -> no matching package found.
- rkeet/yc-core dev-master requires rkeet/yc-account * -> no matching package found.
- rkeet/yc-core dev-develop requires rkeet/yc-account * -> no matching package found.
- rkeet/yc-core dev-develop requires rkeet/yc-account * -> no matching package found.
- Installation request for rkeet/yc-core * -> satisfiable by rkeet/yc-core[dev-develop, dev-master].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Hope one of you can help me out.
Upvotes: 2
Views: 2074
Reputation: 243
You need to add the repository for yc-account to your base package.
when it comes to resolving package repository paths, composer only uses the information stored in your root package. it will scan through the composer.json of all required packages, but the repository definition there is not used.
nevertheless you may still require private repositories, which require other private repositories, but you need to add those to the repository section in your root section as well.
one of the reason is, that otherwise your dependencies could mess around from where you are downloading other packages - which you probably do not want.
see here for further explanations Composer won't load private repository within private repository?
and as mentioned, circular dependencies should always be avoided, it may work once installed, but even then it will break at some point and the longer you build upon it, the more work you have to clean it up.
Upvotes: 4