I'm trying to use a specific branch of repo but getting an error:
composer.json
{
"name": "programmingarehard/arbiter",
"license": "MIT",
"type": "library",
"description": "Convenience library to manipulate Symfony ACL's",
"authors": [
{
"name": "David Adams",
"email": "adams.david.10#gmail.com"
}
],
"autoload": {
"psr-4": {
"ProgrammingAreHard\\Arbiter\\": "src",
"ProgrammingAreHard\\Arbiter\\Spec\\": "spec"
}
},
"require": {
"php": ">=5.3.3",
"symfony/security": "2.4.*"
},
"require-dev": {
"bestform/phpspec": "dev-psr4-support"
},
"config": {
"bin-dir": "vendor/bin"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/bestform/phpspec"
}
],
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}
Error:
Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package bestform/phpspec could not be found in any version, there may be a typo in the package name. 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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
This is the repo/branch i'm trying to pull into my package. Not sure what i'm doing wrong.
The repository you are using does not contain a software named bestform/phpspec. Look at the composer.json that is in there, and use the value given as "name". Its phpspec/phpspec, and any branch will only ever be found if you use that name.
The name of the Github repository is irrelevant. Don't confuse it with the "composer" name.
Related
I'm currently working on a Composer package and now I want to test how it would integrate in my current application without pushing it to a remote.
So I stumbled upon this blog post which explains how to do that. However, that didn't work. I'm getting the message
Your requirements could not be resolved to an installable set of packages.
Problem 1 - The requested package tzfrs/x-bundle could not be found in any version, there may be a typo in the package name.
My directory structure looks like this
dev
Project
composer.json
Package
composer.json
The composer.json of my package looks like this
{
"name": "tzfrs/x-bundle",
"license": "proprietary",
"require": {
"php": "^7.0",
"psr/log": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~5.5"
},
"autoload": {
"psr-4": { "tzfrs\\XBundle\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
}
}
And the one of my project looks like this (I'm leaving the symfony stuff and other packages/stuff out)
{
"repositories": [
{
"type": "git",
"url": "../Package",
}
],
"minimum-stability" : "beta",
"require": {
"tzfrs/x-bundle": "*"
}
}
So when doing composer update tzfrs/x-bundle I should get my new project right? However, I'm getting the message I posted above. What am I doing wrong here?
I already did git init in my package folder and also comitted all my changes. So I have a repo which is not empty already.
i currently ran into a problem with renaming a project in composer.json.
the previos status was like the following:
{
"name": "old/name",
"license": "Business",
"type": "library",
"description": "description",
"autoload": {},
"minimum-stability":"dev",
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"sensio/generator-bundle": "~2.5",
"phpunit/phpunit": "~4.6",
"mockery/mockery": "0.9.4",
"leaphub/phpcs-symfony2-standard": "~2.0.0"
},
"scripts": {
},
"extra": {
},
"branch-alias": {
"dev-master": "2.6-dev",
}
}
}
now i need to change this to
{
"name": "new/name",
"license": "Business",
"type": "library",
"description": "description",
....
}
therefore i created a new branch, changed the information, created a branch-alias to reference it in the target-project.
...
"repositories": [
{
"type": "vcs",
"url": "git#github.com:matthias-chlechowitz/forked-repo.git"
}
],
"require": {
"new/name":"dev-matthias/rewrite-branchname"
}
...
but when running composer update to fetch the updated version, the old version with the previous project name is fetched and the following error message appears:
Problem 1
- The requested package new/name could not be found in any version, there may be a typo in the package name.
so it's not possible to rename projects within one repo or even forks? or am i missing a major part?
best regards,
matthias
thank you for your answer, but referencing a new branch was not the problem (which was working perfectly fine). The problem was really changing the name of the project (name-property in the composer.json).
According to Christophe Coevoet [1], composer always fetches the name from the master branch, so my changes in forked or derived branches doesn't affect the outcome.
Best regards,
Matthias
[1] https://github.com/composer/composer/issues/4677
I have GitHub repo tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001
with example PHP component. This component does not have itself composer.json file.
My objective is getting this component to my project using project's composer.json.
I follow the Julien's answer to Contributing to open source bundles from vendor directory?
I wrote composer.json that describes component as "package"
{
"repositories": [
{
"type": "package",
"package": {
"name": "tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001",
"version": "dev-master",
"source": {
"url": "https://github.com/tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001.git",
"type": "git",
"reference": "master"
},
"autoload": {
"psr-4": {
"TygrolewGmail\\Zawartosc\\Tworcy\\" : "src/Zawartosc/Tworcy/"
},
"files": [
"/src/Zawartosc/Funkcje/_d.php"
]
}
}
}
],
"require": {
"tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001": "dev-master"
},
"autoload": {
"psr-4": {
"": "src/"
}
}
}
It is installing the last commit from master branch.
$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001 (dev-master master)
Cloning master
Writing lock file
Generating autoload files
My repo history gitk all branches history
fc70af [branch:master, no tag]
|
|
| 9941b7 [branch:trial, tag:"v0.0.2"]
| /
|/
c2849e [branch:master, tag:"v0.1"]
|
|
6f8ff7 [branch:master, tag:"v0.0.1"]
My composer.json file is downloading the last commit from master branch. But i want to install some previous versions of component or trial versions.
How to install
The last commit from trial branch.
Commit with specific tag (either from master or trial branch), for example "v0.1"
The Git repos have
branches,
tags
and commits.
composer.json has fields:
"version" inside "repositories"/"package"
"reference" inside "repositories"/"package"/"source"
version value after the package name in the "require"
What is their meaning and how do they relate to GitHub's branches, tags and commits?
Edit
Flosculus answer worked, but I m still a bit confuzed. Correct me, if I do wrong, but I guess "repositories"/"package"/"version" has no connection with GitHub. However it must been used during Composer's "require".
On the other hand, "repositories"/"package"/"source"/"reference" could be anything that Git can checkout, it can be branch, tag, or commit's hash. I tried defining three items in repositories array.
"repositories": [
{
"type": "package",
"package": {
"name": "tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001",
"version": "dev-trial",
"source": {
"url": "https://github.com/tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001.git",
"type": "git",
"reference": "trial"
},
"autoload": {
"psr-4": {
"TygrolewGmail\\Zawartosc\\Tworcy\\" : "src/Zawartosc/Tworcy/"
},
"files": [
"/src/Zawartosc/Funkcje/_d.php"
]
}
}
},
{
"type": "package",
"package": {
"name": "tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001",
"version": "0.1",
"source": {
"url": "https://github.com/tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001.git",
"type": "git",
"reference": "v0.1"
},
"autoload": {
"psr-4": {
"TygrolewGmail\\Zawartosc\\Tworcy\\" : "src/Zawartosc/Tworcy/"
},
"files": [
"/src/Zawartosc/Funkcje/_d.php"
]
}
}
},
{
"type": "package",
"package": {
"name": "tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001",
"version": "1.2.3",
"source": {
"url": "https://github.com/tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001.git",
"type": "git",
"reference": "fc70af"
},
"autoload": {
"psr-4": {
"TygrolewGmail\\Zawartosc\\Tworcy\\" : "src/Zawartosc/Tworcy/"
},
"files": [
"/src/Zawartosc/Funkcje/_d.php"
]
}
}
}
],
First defines version "dev-trial" as checkout trial branch which gives the last commit of that branch
Second defines version "0.1" as checkout tag "v0.1"
Third defines version "1.2.3" (non-existing in the GitHub) as checkout commit "fc70af"
To get them I use respectively three requires
"require": {
"tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001": "dev-trial"
},
2.
"require": {
"tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001": "0.1"
},
3.
"require": {
"tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001": "1.2.3"
},
When using the VCS type for repositories, Composer will scan each branch and tag for Composer files. From there, based on the branch and tag names, it can assemble a list of packages.
These packages (like the one you created to reference that repository) exist on packagist.org, which is the default lookup for Composer. The Authors of the repositories put them on Github.
In this case however, the repository is not on Packagist, and it has no composer file on any of it's versions. So what you have done, is created a generic repository. You can do the same thing with local directories, and zip files (local or remotely). However your one is a Git repository.
See modified json:
{
"repositories": [
{
"type": "package",
"package": {
"name": "tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001",
"version": "dev-master",
"source": {
"url": "https://github.com/tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001.git",
"type": "git",
"reference": "v0.0.1"
},
"autoload": {
"psr-4": {
"TygrolewGmail\\Zawartosc\\Tworcy\\" : "src/Zawartosc/Tworcy/"
},
"files": [
"/src/Zawartosc/Funkcje/_d.php"
]
}
}
}
],
"require": {
"tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001": "dev-master"
},
"autoload": {
"psr-4": {
"": "src/"
}
}
}
When Packagist or Composer (Packagist also has a copy of Composer), scans a VCS repository, it flattens out all of the versions into multiple packages with the same name, but different versions. In your case "references". The modified json above uses "reference": "v0.0.1" to indicate a specific tag/branch.
https://github.com/composer/satis/issues/29
This is an issue requesting support for VCS repositories without composer files. However it doesn't work. When you modify the repository like so:
{
"type": "vcs",
"url": "https://github.com/tygrolew-gmail/przykladowy-komponent-php-tygrolewa-gmaila-0001.git"
}
This should work if the repo had the composer.json file. In fact when you run composer update with this, you can see it searching each branch and tag. But without the relevant composer file, all you will get is this:
[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of
https://github.com/tygrolew-gmail/przykladowy-komponent-p
hp-tygrolewa-gmaila-0001.git, could not load a package from it.
I create a widget that is under development. The problem is that when I run:
composer require chofoteddy/yii2-bootstrap-wizard "*"
I get the following message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for chofoteddy/yii2-bootstrap-wizard * -> satisfiable by chofoteddy/yii2-bootstrap-wizard[dev-master].
- chofoteddy/yii2-bootstrap-wizard dev-master requires vinceg/twitter-bootstrap-wizard * -> no matching package found.
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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
What I seek is to add https://github.com/VinceG/twitter-bootstrap-wizard.git repository as a dependency of my project. "VinceG/twitter-bootstrap-wizard" is not registered in "Packagist".
I modified many times my composer.json file, in order to correct it, but I can not make it work.
My file composer.json:
{
"name": "chofoteddy/yii2-bootstrap-wizard",
"description": "Wizard form based on twitter bootstrap plugin (#VinceG)",
"homepage": "https://github.com/Chofoteddy/yii2-bootstrap-wizard",
"keywords": [
"yii2",
"wizard",
"bootstrap",
"yii2-extension"
],
"type": "yii2-extension",
"version": "0.1",
"license": "MIT",
"authors": [
{
"name": "Christopher",
"email": "chofoteddy88#yahoo.com.mx"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"VinceG/twitter-bootstrap-wizard": "*"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/VinceG/twitter-bootstrap-wizard"
}
],
"autoload": {
"psr-4": {
"chofoteddy\\wizard\\": ""
}
}
}
Composer information:
sudo composer self-update
You are already using composer version b2173d28fc8b56236eddc8aa10dcda61471633ec.
Because VinceG/twitter-bootstrap-wizard is not a Composer package (it does not include a composer.json) you have to define this in your composer.json
Your repository section should look like this:
"repositories": [
{
"type": "package",
"package": {
"name": "VinceG/twitter-bootstrap-wizard",
"version": "1.2",
"dist": {
"url": "https://github.com/VinceG/twitter-bootstrap-wizard/archive/1.2.zip",
"type": "zip"
},
"source": {
"url": "https://github.com/VinceG/twitter-bootstrap-wizard.git",
"type": "git",
"reference": "1.2"
}
}
}
],
You might also have a look at component-installer and the composer-asset-plugin to manage components and bower packages within composer.
The problem is probably the minimum-stability defined in your project root composer.json (or if not defined it defaults to stable)
As the bower repository has no release yet you should:
"VinceG/twitter-bootstrap-wizard": "#dev"
define minimum-stability: "#dev"
Please note that if you use this package from a different project you need to either define minimum-stability: "#dev" in that project or define the
"VinceG/twitter-bootstrap-wizard": "#dev" in root composer.json
There's also an option in composer which lets you specify: "prefer-stable"
More info on this:
https://igor.io/2013/02/07/composer-stability-flags.html
I have two symfony2 projets A and B.
My goal is to add the project B into the project A as a vendor.
What I did:
Edited the composer.lock file in the A project to include the project B as vendor:
"name": "sciforum/journals_revie_bundle",
"version": "dev-master",
"target-dir": "SciForum/JournalsReview",
"source": {
"type": "git",
"url": "ssh://git#dev.mdpi.lab:22/~/projects/journals_review",
"reference": "dc8ea6a551e5d42b972dd302b75d9ce0a26735f3"
},
"require": {
"php": ">=5.3.3"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-0": {
"SciForum\\JournalsReview\\": ""
}
},
"description": "SciForumJournalsReview",
"homepage": "http://www.sciforum.net",
"time": "2014-11-14 11:11:33"
},
Changed the composer.json in the project B
{
"name" : "sciforum/journals_review_bundle",
"type" : "symfony-bundle",
"description" : "SciForumJournalsReviewBundle",
"homepage" : "http://www.sciforum.net",
"require" : {
"php" : ">=5.3.3"
},
" autoload" : {
"psr-0" : {
"SciForum\\JournalsReviewBundle\\" : ""
}
},
"target-dir" : "SciForum/JournalsReviewBundle",
"extra" : {
"branch-alias" : {
"dev-master" : "2.0-dev"
}
}
}
Imported the bundle in the project A AppKernel.php
new SciForum\JournalsReview\SciForumJournalsReviewBundle(),
And when trying to do
sudo php composer.phar install
I am getting
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package sciforum/journals_review_bundle could not be found in any version, there may be a typo in the package name.
Problem 2
- The requested package sciforum/journals_revie_bundle could not be found in any version, there may be a typo in the package name.
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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Any idea? Thank you.
Instead of using custom vendors, what I did is that I included this custom bundle as a secondary bundle in my main project, and everything works perfectly well.