How to instal phpDocumntor on Symfony4? - php

I'm trying to install phpDocumentor on my project, but I've got this problem.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpdocumentor/phpdocumentor[v3.1.0, ..., v3.1.2] require symfony/cache ^5.0 -> found symfony/cache[v5.0.0, ..., v5.3.7] but the package is fixed to v4.4.30 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires phpdocumentor/phpdocumentor ^3.1 -> satisfiable by phpdocumentor/phpdocumentor[v3.1.0, v3.1.1, v3.1.2].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
I really don't want to change my Symfony version and I haven't found the way to install the phpDoc on that project :c Do you have any ideas how to install it without changing my project version?

Taking a quick look at the phpDocumentor history, I don't think there's a version that'll be compatible with Symfony 4; they go from Symfony 2 on v2.9 to Symfony 5 on v3.0.
I'm not sure you'd want to tie up your project's requirements with those of an external tool like that, anyway.
I'd suggest using the phar distribution. If you want it included with your project when it's cloned, you can either commit it to the repo or download it with a Composer script on install.

Related

resolving composer conflict - unclear on dependency 'rules'

I have a version of laravel that I am trying to add a third-party non-laravel webservice api wrapper into. the wrapper has a requirement for guzzle >= 6 and the version of laravel has a requirement for guzzle ^7
Looking at the api, it doesn't use anything complex in guzzle so I'm pretty sure it's usage of it will be compatible with v7. Reading the composer docs, I see where it says the use of the caret restricts it to => 7 but < 8, but I don't understand why the >= 6 on the second package is causing a conflict (it's not using the caret and is saying it can use anything greater than 6)
How do I resolve this conflict so I can use this API within my website code?
updated:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires jacob-hyde/printify ^1.0 -> satisfiable by jacob-hyde/printify[v1.0].
- jacob-hyde/printify v1.0 requires guzzlehttp/guzzle ^6.3 -> found guzzlehttp/guzzle[6.3.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
OK, as shown in the comments - the one that was published on packagist had a different composer.json than the one on github. For the time being, I'm just adding a repositories entry in the composer.json rather than creating/refactoring/testing a fork while building my own api interface. ugh

Symfony - (1/1) InvalidConfigurationException - Unrecognized option "mailer" under "framework"

I'm quite new at Symfony and struggle with this issue for my internship, when trying to run the project locally :
(1/1) InvalidConfigurationException
In ArrayNode.php line 331:
Unrecognized option "mailer" under "framework". Available options are "annotations", "assets", "cache", [...], "workflows".
I'm running PHP 7.4 and Symfony 4, adapting a symfony project from another dev.
In my .env file, I got swiftmailer bundle, I believe mailer was a different kind of mailer bundle used..?
I tried the following request :
composer require symfony/mailer
And got this :
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Using version ^5.2 for symfony/mailer
./composer.json has been updated
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Running composer update symfony/mailer
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/mailer[v5.2.0, ..., v5.2.2] require symfony/event-dispatcher ^4.4|^5.0 -> found symfony/event-dispatcher[v4.4.0, ..., v4.4.19, v5.0.0, ..., v5.2.2] but the package is fixed to v4.2.8 (lock file version) by a partial up
date and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires symfony/mailer ^5.2 -> satisfiable by symfony/mailer[v5.2.0, v5.2.1, v5.2.2].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Thanks for your help !
If you're kickstarting another dev's project, you probably don't need any composer require. All you have to do is run composer install in project directory to get all the same packages, as previous developer.

Problem with TravisCI version matrix after updating to composer 2.0

After updating to Composer 2.0 I got into problems on doing my Travis.
I have a TYPO3 Extension, that I want to test with multiple TYPO3 Versions. Till yesterday I could do this with composer require nimut/typo3-complete:$TYPO3_VERSION (coming from the version Matrix).
After the update I got following error/information.
Cannot update only a partial set of packages without a lock file present.
Installation failed, reverting ./composer.json to its original content.
As I have no composer.lock in my repository, I tested my pipeline with a composer install first, and then did the update. This is all fine until I go to the next version as the dependencies are different, and the composer.lock from the composer install cannot update the additional dependencies.
I have tried it with composer require --dev nimut/typo3-complete:^10.4 --with-all-dependencies the response from composer:
Problem 1
- typo3/testing-framework is locked to version 4.15.2 and an update of this package was not requested.
- typo3/testing-framework 4.15.2 requires typo3/cms-backend ^9.3 -> found typo3/cms-backend[v9.3.0, ..., 9.5.x-dev] but it conflicts with another require.
Problem 2
- symfony/http-client v5.1.7 requires symfony/http-client-contracts ^2.2 -> found symfony/http-client-contracts[dev-main, dev-master, v2.2.0, v2.3.1, 2.3.x-dev (alias of dev-master)] but it conflicts with another require.
- nunomaduro/phpinsights v1.14.0 requires sensiolabs/security-checker ^6.0 -> satisfiable by sensiolabs/security-checker[v6.0.3].
- sensiolabs/security-checker v6.0.3 requires symfony/http-client ^4.3|^5.0 -> satisfiable by symfony/http-client[v5.1.7].
- nunomaduro/phpinsights is locked to version v1.14.0 and an update of this package was not requested.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
The -W option is the one I'm trying out already. I have tried both -w and -W, no luck so far.
I'm not sure how to get around this problem yet, your input your be very helpful.
Link to .travis.yml
https://github.com/AOEpeople/crawler/blob/master/.travis.yml#L50
Link to Travis Build where testing it out.
https://travis-ci.org/github/AOEpeople/crawler/jobs/738603105#L1138
The issue with composer require was reported and fixed in PR 9336 on Composer's GitHub repository. It will be in Composer 2.0.2 just about to be released now. So you can upgrade to 2.0.2 and it should resolve your problem.
To explain why your workaround failed:
composer require nimut/typo3-complete:$TYPO3_VERSION edits the composer.json file to add "nimut/typo3-complete": "^$TYPO3_VERSION". Then it runs composer update nimut/typo3-complete, or (on Composer 1.x or 2.0.2+) a plain composer update if no lock file exists yet.
If you run a composer install without a lock file first, this executes a composer update because there is no lock file. The subsequent composer require then still edits the json file and now runs composer update nimut/typo3-complete because there is a lock file. Even with all the dependency options enabled, this may have a different outcome or even a conflict from running a plain composer update as you are restricting the update to only the new package and its dependencies.

How to downgrade symfony/console, can't install composer package?

i need to use this package mrjgreen/db-sync, i'm using laravel version 5.8.
When i try to install it on my project through composer, it returns the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install mrjgreen/db-sync v3.3.0
- Conclusion: remove symfony/console v4.4.3
- Installation request for mrjgreen/db-sync ^3.3 -> satisfiable by mrjgreen/db-sync[v3.3.0, v3.x-dev].
- Conclusion: don't install symfony/console v4.4.3
I tried to remove symfony/console, but it gives me this message:
"symfony/console is not required in your composer.json and has not been
removed"
and it won't remove it. Any idea of how can i solve this?. Or a similar package that it's compatible with this laravel version. (i need to sync two tables but using a where parameter). Thanks in advance.
The last release of the package you are using was in May 2017 (two and a half years ago at the time of writing). It was built against specific versions of the symfony packages, and since you are now using a younger version of Laravel with different dependencies (which also uses symfony), you are getting a conflict of libraries.
There's no easy solution for you other than find another library to do what you need, fork the library you are trying to use and build your own against the modern dependencies (which should be straight forward if it has a full set of tests), or build your own.
I had this issue as well. I removed laravel/valet and laravel/installer, then installed again and it worked.
composer global remove laravel/valet
Then
composer global remove laravel/installer
Then
composer global require laravel/installer

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