Failing to get package via composer require - php

I want to user this package hslavich/simplesamlphp-bundle in my project which has dependency on simplesamlphp/simplesamlphp dev-master
If I try to add dependency like this:
composer require hslavich/simplesamlphp-bundle dev-master
I get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for hslavich/simplesamlphp-bundle dev-master -> satisfiable by hslavich/simplesamlphp-bundle[dev-master].
- hslavich/simplesamlphp-bundle dev-master requires simplesamlphp/simplesamlphp dev-master -> no matching package found.
If I git clone the hslavich/SimplesamlphpBundle and use composer update simplesamlphp package is downloaded successfully.
What am I doing wrong?

Add "minimum-stability": "dev" to composer.json. The usage of dev package versions imples that you need to have it. Use
"minimum-stability": "dev",
"prefer-stable" : true
if you don't want it to affect other packages without strict version constraints.

Related

Failed while installing a package using composer

iam tryin to use a cart package by using this command
composer require jason-napolitano/codeigniter4-cart-module
and it's failed. this is what it said
Using version dev-master for jason-napolitano/codeigniter4-cart-module
./composer.json has been updated
Running composer update jason-napolitano/codeigniter4-cart-module
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires jason-napolitano/codeigniter4-cart-module dev-master -> satisfiable by jason-napolitano/codeigniter4-cart-module[dev-master].
- jason-napolitano/codeigniter4-cart-module dev-master requires codeigniter4/framework ^4.0.3 -> satisfiable by codeigniter4/framework[v4.0.3, ..., v4.1.1] from composer repo (https://repo.packagist.org) but codeigniter4/framework[1.0.0+no-version-set] from root package repo has higher repository priority. The
packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
is it because my minimum-stability in composer.json is set to "stable"?
I presume you created your project by using composer create-project codeigniter4/framework. This effectively created a clean project for you without the .git folder, thus removing any metadata on what version of codeigniter4/framework package you installed. This is indicative by 1.0.0+no-version-set part of the error message.
The jason-napolitano/codeigniter4-cart-module package requires ^4.0.3 version of codeigniter4/framework, but since you have no version metadata in your project, install fails. This can be resolved by setting the version from which you bootstrapped your project manually in your root composer.json:
{
"name": "codeigniter4/framework",
"version": "4.0.3",
...
}
However, this is just a guess, since I have no insight into your main composer.json.
Your PHP is missing intl extension. It is useful for formatting currency, number and date/time as well as UCA-conformant collations, for message formatting and normalizing text..etc.
Check out Codeignitor 4 [Documentation][1]:
Follow the steps to install it in XAMPP -
Open [xampp_folder_path]/php/php.ini to edit.
Search for ;extension=intl and remove the ;.
Save the php.ini file and restart Apache.

Why do my dependencies of a dependency conflict when installing in composer-php?

I am running composer install inside a directory with the following composer.json file:
{
"name" : "Sprout Setup",
"description" : "Allows the easy set up of a WordPress website",
"autoload" : {
"files": [],
"psr-4" : {
"SproutSetup\\": "SproutSetup/"
}
},
"require" : {
"sproutwp/sprout_services" : "*#dev"
}
}
But I'm getting the following errors:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for sproutwp/sprout_services *#dev -> satisfiable by sproutwp/sprout_services[dev-master].
- sproutwp/sprout_services dev-master requires sproutwp/sprout_interfaces *#dev -> satisfiable by sproutwp/sprout_interfaces[dev-master] but these conflict with your requirements or minimum-stability.
The packages' github repos:
https://github.com/sproutwp/sprout_services
https://github.com/sproutwp/sprout_interfaces
https://github.com/sproutwp/sprout_privileges
As you can see, I require that sprout_services make use of sprout_interfaces|sprout_privileges with any kind of *dev version, yet it still says it's not matching the requirements.
I'm inclined to think that I need to declare a minimum-stability flag, if that's the case, then why?
You must declare a minimum-stability flag in the composer.json where you're running composer install on:
"minimum-stability" : "dev",
"prefer-stable": true

Symfony : sonata admin bundle install error

I'm trying to install sonata on a new Symfony 3 project.
I follow this installation guide : https://tech.acseo.co/symfony-sonata-admin-tutoriel/ ( dev-master )
I run these commands :
composer require sonata-project/admin-bundle "dev-master"
composer require sonata-project/doctrine-orm-admin-bundle "dev-master"
But I have these errors in my console :
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for sonata-project/doctrine-orm-admin-bundle dev-master -> satisfiable by sonata-project/doctrine-orm-admin-bundle[dev-master].
- sonata-project/doctrine-orm-admin-bundle dev-master requires php ^5.6 || ^7.0 -> your PHP version (5.6.25) overridden by "config.platform.php" version (5.5.9) does not satisfy that requir
ement.
Installation failed, reverting ./composer.json to its original content.
It's the first time I use sonata, can you help me ?
Thanks you for your response.
Somewhere in your composer.json you have this.
"config": {
"platform": {
"php": "5.5.9"
}
},
This overrides your PHP version and you see this erroryour PHP version (5.6.25) overridden by "config.platform.php" version (5.5.9). Remove it
since Sonata needs PHP > 5.6.
In some cases another trick can help. While you are installing any package by compose you can use --ignore-platform-reqs.
Therefor, you could try
composer require sonata-project/admin-bundle "dev-master" --ignore-platform-reqs
The only problem, that this cheat can break down your dependencies in future, or the bundle you installed use language features of new version, that are incompatible with your minor version.
Using of "--ignore-platform-reqs" - is your consideration.
I've found a solution, I've installed this https://github.com/pierre-vassoilles/symfony2-sonata-base-project
and it works :D
Thank you for your answer :)

mynamespace/packageA 1.0.x-dev requires mynamespace/package-virtual 1.0 -> no matching package found

I have several packages. One depends on a virtual package that 2 of the others provides. For the simplicity sake I am only focusing on packageA (package that requires the virtual) and packageB (one of the packages that provides the virtual).
PackageA
{
"require": {
"mynamespace/package-virtual": "1.0"
},
"suggest": {
"mynamespace/packageB": "PackageB provides package-virtual",
"mynamespace/packageC": "PackageC also provides package-virtual and can be installed with or without PackageB being present"
},
"minimum-stability": "dev"
}
PackageB
{
"provide": {
"mynamespace/package-virtual": "1.0"
},
"minimum-stability": "dev"
}
This all worked fine while I was using dev-master as a requirement for both packges in my application that used both of these packages:
MyAPP using dev-master
{
"require": {
"mynamespace/packageA": "dev-master",
"mynamespace/packageB": "dev-master"
},
"minimum-stability": "dev",
"prefer-stable": true
}
However, when I tagged 1.0.0-rc1 on each package and attempted to change my dev requirement to 1.0.x-dev composer started complaining that it could not find mynamespace/package-virtual
MyAPP using 1.0.x-dev
{
"require": {
"mynamespace/packageA": "1.0.x-dev",
"mynamespace/packageB": "1.0.x-dev"
},
"minimum-stability": "dev",
"prefer-stable": true
}
Running composer update
# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for mynamespace/packageA 1.0.x-dev -> satisfiable by mynamespace/packageA[1.0.x-dev].
- mynamespace/packageA 1.0.x-dev requires mynamespace/package-virtual 1.0 -> 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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Things I have already tried
Changing the requires line for mynamespace/package-virtual to ^1.0 in mynamespace/packageA
Changing the requires line for mynamespace/package-virtual to 1.0.* in mynamespace/packageA
Changing the provides line for mynamespace/package-virtual to 1.* in mynamespace/packageB
Why am I using a virtual and not just requiring packageB
Because packageB is only a possible implementation of the virtual package. packageC or some other package could potentially be used instead.
Why am I not using replaces instead of provides
Because packageB and packageC could both implement the virtual package and co-exist. MyAPP may choose to use packageB in some scenarios and packageC in others. Compare all of this to logging packages. psr/log provides the interfaces for logging, but you must install one or more logging implementations to actually use it for logging. Many different loggers implement the necessary interfaces and could all be installed simultaneously allowing the application to provide the user a selection of logging services to use.
Why am I providing psuedo code instead of the actual composer.json files
Because the code I am working on is not currently publicly available. At some point it may be, but it is not now
If the code isn't publicly installable, how are you installing via composer?
I am running Toran Proxy locally
Question
What am I doing wrong? Why did this all work fine under dev-master but start failing once I tagged an RC and moved to a version branch.
So I am not sure if this is the actual answer, but if I run composer installinstead of composer update after clearing the mynamspace directory from vendor, everything works fine.
I also did find that using Satis instead of Toran seemed to work fine with composer update as well.

Satis circular dependencies

I have a project with multiple packages
Each package is in a private git repository.
Some of the packages have dependencies of each other.
You can check here how my satis http://codepen.io/anon/pen/wBOEQW page looks like.
Now if I clone the project-xpto/core, and run a composer update i get this:
➜ php-core git:(master) composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for project-xpto/event dev-master -> satisfiable by project-xpto/event[dev-master].
- project-xpto/event dev-master requires project-xpto/activity-streams dev-master -> no matching package found.
Problem 2
- Installation request for project-xpto/tool dev-master -> satisfiable by project-xpto/tool[dev-master].
- project-xpto/tool dev-master requires project-xpto/activity-streams dev-master -> 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 <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
satis.json => http://pastie.org/private/s0e2rxtnvpv9g7rpp415a
composer.json xpto-core => http://pastie.org/10062586
composer.json xpto-event => http://pastie.org/private/stxe2sbwpja8088knrldq
composer.json xpto-tool =>
http://pastie.org/private/11o9wv94kvfprl5wjfibrq
composer.json
xpto-activity-streams =>
http://pastie.org/private/plieipe2gco1yt4gs0jxg
Isn't suppose to satis resolve all dependencies and all work fine?
What i'm doing wrong?
If you need anything else, just ask i will update here.
Please give this a try:
add "minimum-stability": "dev" to the composer.json of project-xpto/core.
You require a lot of dev-master stability packages, but the default minimum-stability is stable. So they are not resolved to a stable set. You need to lower stability for all packages to dev by setting the above directive in your main projects composer.json.
Alternatively you could use dev-master#dev to lower stability on a specific package. But here it's quite a number of packages, so i would suggest to set minimum-stability dev for the whole project.
You can combine "minimum-stability dev" with "prefer-stable true".
This tells Composer to resolve to stable versions AND ONLY if stable could not be resolved, use a dev dependency. This setting is a good way in the starting phase of a private project, where packages start to grow out of "dev-master" and into "stable versions".
"minimum-stability": "dev",
"prefer-stable" : true

Categories