How to force a package to be installed? - php

I'm trying to install the following package through composer:
https://packagist.org/packages/cartalyst/sentry#dev-feature/laravel-5
When I do:
composer require cartalyst/sentry dev-feature/laravel-5
I always receive this error:
[InvalidArgumentException]
Could not find package dev-feature/laravel-5 at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
If I change minimum-stability to dev it will still complain.
However, if I install dev-master and manually merge the files from dev-feature/laravel-5 into dev-master, it works fine.
Hence why I'm asking how to force this package to be installed via composer.

To force the installation of this package, I added the following to the require element of composer.json:
"cartalyst/sentry":"dev-feature/laravel-5 as 2.1.4"
Below is the link from where I found this suggestion:
http://vvv.tobiassjosten.net/php/have-composer-use-development-branches/
It will not work from the command line, must be through composer.json. That I don't know why.
Update:
I believe I was wrong in my last statement above, actually something like the following will work from the command line:
composer require "codeception/codeception":"2.1.0-rc1 as 2.0.9"

Try to use this
composer require "cartalyst/sentry": "2.0.*#dev"
I believe sentry is not fully compatible with Laravel 5 yet

Related

Composer doesn't update outdated dependencies

Well, after running command composer outdated I can see there's newer version of phpdocumentor/type-resolver available. Installed version is 0.2.1 and the latest one is 0.3.0. Need to say that it was indirectly installed by component I use and not by me.
Problem is when I run composer update or composer update phpdocumentor/type-resolver it says "Nothing to install or update". Why and how to fix?
probably some dependency have fixed the package release you want to install. Try so the the output of the command to check who are using and at which version the package you listed:
composer why-not phpdocumentor/type-resolver 0.3.0
NB: in the current version of the documentation of composer the command is named prohibits, so in case this doesn't work try with:
composer prohibits phpdocumentor/type-resolver 0.3.0
Hope this help
You might have version constraints blocking the upgrade in your composer.json file. This is intended to prevent adding in breaking changes. In your example, the versions are pre-release (0.*), so versioning constraints even act on the miner version.
If you are confident there are no breaking changes or you are prepared to deal with them, edit your composer.json file. Change something like:
"phpdocumentor/type-resolver": "0.2.1",
to
"phpdocumentor/type-resolver": "^0.3",
Try composer upgrade again and test it out to make sure everything is ok.

Symfony 2.8 TinyMCE install bundle error

i am on symfony 2.8, and my php version is 5.5.9.
i'm trying to install TINYMCE bundle from composer. I used this command line:
php composer.phar require stfalcon/tinymce-bundle='1.0'
i had this message error:
i tried with v2.0 but same problem.
Have you an idea ?
Thank's a lot for your help.
It would seem that in your composer.json's config section you have platform requirements that conflict with the bundle.
https://getcomposer.org/doc/06-config.md#platform
You could try installing the requirements using the option --ignore-platform-reqs:
composer require stfalcon/tinymce-bundle --ignore-platform-reqs
composer install --ignore-platform-reqs
This will momentarily lift the specified platform requirements. Obviously if they are in place, because they are actually needed - and since they were put there deliberately, at least at some point they were - this might break things on production. So be careful and look at the above option first (updating or removing the platform requirements).
Have you tried either of these two commands:
composer.phar require stfalcon/tinymce-bundle='1.0'
composer require stfalcon/tinymce-bundle='1.0'
I'm not sure if it will make a difference, but it might.

Composer installation order

Is it possible to set the installation order?
Currently I'm using Doctrine module that requires ext-mongo to be installed, but as I'm using the newer php version (7.0) I have mongodb installed instead. There's a alcaeus/mongo-php-adapter package that resolves installation problems. But there's one problem - Composer is trying to install Doctrine modules first, so that installation fails.
Currently I have to resolve this problem manually, but I can't do it any more as I'm going to pack my environment to a Docker image to let it be automatically deployed later.
From the docs of alcaeus/mongo-php-adapter
"
$ composer require alcaeus/mongo-php-adapter
If your project already has a dependency on ext-mongo, the command above may not work. This is due to a bug in composer, see https://github.com/composer/composer/issues/5030
To fix this, you can use the --ignore-platform-reqs switch when running the above command, or when running composer update with no composer.lock file present."

Error and warning while installing CodeIgniter through Composer

I tried to install CodeIgniter through composer using this:
composer require bcit-ci/CodeIgniter
And it installed successfully I got a warning, see screenshot
And then I tried to install with this:
composer require codeigniter/framework
and I got a fatal error, see screenshot here
I don't know what I am doing wrong.
See all screenshots here: http://imgur.com/a/zsnER
I just removed the cache of Composer and tried to install again and I got success.
this is weird that composer trying to install the very first package 1.0.0 , works perfectly at my side.
however , you will need to pass the package version statically as follows:
composer require codeigniter/framework:"3.1-stable"
this will often -till the answer date- install 3.1.0 version,
you may try to download the latest version :
composer require codeigniter/framework:"3.1.4"

How would I only update one composer dependency?

I expected that
composer update videlalvaro/php-amqplib
would only update one dependency, but instead of that it updates all.
What am I missing?
PS: this dependency is defined as "videlalvaro/php-amqplib": "2.2.0" in composer.json
PPS: the composer version used is 3da05c68f9561fa822c522b1815435ff990493ff 2013-10-02 14:25:06
PPPS: the actual output:
$ composer.phar update videlalvaro/php-amqplib --no-dev
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- Installation request for symfony/icu == 1.2.0.0 -> satisfiable by symfony/icu[v1.2.0].
The command composer update videlalvaro/php-amqplib does just update that dependency. However it doesn't disable the other dependency checking that Composer does.
What the error message is complaining about is that the lib-icu is not available on your system. Apparently this would be solved by installing the PHP Intl extension.
You would see similar issues if you did a composer update on a project that required PHP 5.5 in one of it's requires, downgraded to PHP 5.4 and then ran composer update on a separate require, that didn't require PHP 5.5. Even though you wouldn't be updating the require that needs PHP 5.5, the requirements for that package would not be resolvable, and so Composer would fail.
In your case, even though you're just trying to update videlalvaro/php-amqplib to the latest version, the requirements for symfony/icu aren't met, and so the composer update fails.
Edit
To try to be helpful, I'm guessing you re-installed PHP since you last did an update, and either removed or forgot to install the PHP Intl extension. Composer can't satisfactorily satisfy the requirements your composer.json is setting, and so is defaulting to doing nothing, rather than knowingly doing an update where the requirements aren't met.
So basically, you need to install the PHP extensions that are required for your existing installed software to run, and then Composer will be able to update the single package you want to update, as well as meet the requirements for the other packages.
tl;dr:
You can list more than one dependency to update in one command:
composer update one/dependency second/dependency other/dependency
Story:
If you want to update only one dependency (composer update some/dependency), you may face an issue that request is not satisfiable due to some other dependency is installed in wrong version. And that one does not necessarily must be listed in your composer.json, it could be just dependency of some other dependency.
E.g. I wanted to update only and only google/apiclient, but calling composer update google/apiclient complained, that google/auth (dependency of apiclient) requires guzzlehttp/psr7 in version 1.2.3. I had 1.3.0 installed. The guzzlehttp/psr7 was not listed in my composer.json. What I had to do, was to call:
composer update guzzlehttp/psr7 google/apiclient
and that's it! Just update the package you want, and if composer tells you, that you need to update (or downgrade :-)) some other package, list it in the command.
I had a similar case due to security reasons on a GitHub repository.
I solved updating the dependency to a specific version like this:
composer require phpseclib/phpseclib:2.0.31
If you are working with virtual environments like docker containers (ddev, lando, etc..) before running it you should connect to the container with a:
ddev ssh
To overcome this kind of dependency problem during the update of a specific package you should specify all the specific packages versions before running their update altogether.
In your case something like this:
composer require videlalvaro/php-amqplib:2.2.0 --no-update
composer require symfony/icu:1.2.0 --no-update
composer require lib-icu:4.4 --no-update
composer update videlalvaro/php-amqplib symfony/icu lib-icu

Categories