Closed still-dreaming-1 closed 1 year ago
Hi @still-dreaming-1,
default composer installs version 2.6
I guess you have some other dependency with a dependency on amphp/amp
, maybe vimeo/psalm
? If it's psalm, you can use the PHAR installation instead (also available as a Composer package).
extremely outdated version of that package
What does extremely outdated mean?
So now I'm not sure what is the "recommended" version of http-client to use with version 3 of amp.
If you want to use fibers and Amp v3, you'll have to use the 5.x beta versions of amphp/http-client
. Version 4.x is compatible with Amp v2. A stable 5.0 release should be out in the coming weeks.
Does the documentation always default to the recommended version or the latest development version?
The documentation on the website reflects the packages compatible with Amp v3 right now. You can find the older documentation in the version-specific branches of the repositories in the docs
directory.
So the non-beta amp 3 requires beta libraries?
No, you got that backward. Amp v3 is stable now, but amphp/http-client
, which has a dependency on amphp/amp
is still a beta version and doesn't have a stable release, yet.
Is amp 3 the recommended one to start out with or should I be using 2.6?
If you're starting a new project, I'd highly recommend Amp v3, yes. If you care a lot about not using beta versions and need one of the packages without a stable release, you can of course still use the older versions, but they come with a lot of boilerplate compared to the new versions using fibers.
I don't want to use buggy technology either, I want it to have a high level of reliability.
That's exactly what we want too, so we're running this rather long beta cycle for the new versions. We try to keep them as stable and bug-free as possible. We don't release with known bugs, even in the beta phase, unless the bug is already present in an earlier version and we need to fix another bug of course, then we might not wait to get rid of all bugs before tagging a release.
Thanks. I understand it better now. One oddity. In a fresh, new directory, if I install amphp/amp 3 first, and then run composer require amphp/http-client
, it installs v0.7.1.
I cannot reproduce this, so there must be something on your system preventing the install. Try requring the version you actually want to require and Composer will tell you what's missing.
I'm facing the same problem on fresh symfony application.
$ composer req amphp/http-client
./composer.json has been updated
Running composer update amphp/http-client
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 0 updates, 0 removals
- Locking amphp/http-client (v0.7.1)
- Locking daverandom/addr (v0.2.2)
- Locking daverandom/libdns (v0.2.1)
- Locking rdlowrey/alert (v0.8.1)
composer.json:
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"amphp/amp": "^3.0",
"symfony/console": "6.3.*",
"symfony/dotenv": "6.3.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "6.3.*",
"symfony/http-client": "6.3.*",
"symfony/runtime": "6.3.*",
"symfony/yaml": "6.3.*"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.3.*"
}
},
"require-dev": {
"symfony/maker-bundle": "^1.50"
}
}
PHP 8.2.8 (cli)
Even with that example, I cannot reproduce this. What's your Composer version?
➜ composer req amphp/http-client
Using version ^4.6 for amphp/http-client
./composer.json has been updated
Running composer update amphp/http-client
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- amphp/http-client[v4.6.0, ..., v4.6.3] require amphp/amp ^2.4 -> found amphp/amp[v2.4.0, ..., v2.6.2] but it conflicts with your root composer.json require (^3.0).
- Root composer.json requires amphp/http-client ^4.6 -> satisfiable by amphp/http-client[v4.6.0, v4.6.1, v4.6.2, v4.6.3].
Composer version 2.5.1
I'm using: composer 2.5.8. Ubuntu 20.04.6 LTS from WSL2 from Windows 10
It does allow me to install amphp/http-client 5 explicitly with no issues, so I'm not exactly needing support anymore, just indicating that by default it still installs v0.7.1, which is probably not what you want other users to experience.
Thanks, I can reproduce it with the latest version of Composer, was using an older version before:
➜ composer self-update
Upgrading to version 2.5.8 (stable channel).
Use composer self-update --rollback to return to version 2.3.10
The previous version 2.3.10 resulted in this error:
➜ composer req amphp/http-client
Using version ^4.6 for amphp/http-client
./composer.json has been updated
Running composer update amphp/http-client
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- amphp/http-client[v4.6.0, ..., v4.6.3] require amphp/amp ^2.4 -> found amphp/amp[v2.4.0, ..., v2.6.2] but it conflicts with your root composer.json require (^3.0).
- Root composer.json requires amphp/http-client ^4.6 -> satisfiable by amphp/http-client[v4.6.0, v4.6.1, v4.6.2, v4.6.3].
Composer selects 0.7.1, because you have "amphp/amp": "^3.0"
in composer.json
, but there's no stable release compatible with Amp v3, yet. This makes Composer look at older versions and makes it find 0.7.1, which is the last version that didn't depend on amphp/amp
. At the time, the package was still called rdlowrey/alert
, so there's no conflict with the requested version of amphp/amp
and that version is a stable release.
This will solve itself once we release the stable release of amphp/http-client@5.0.0
.
If you follow the directions at https://amphp.org/installation, by default composer installs version 2.6. But the documentation is for version 3 and version 3 is the latest non-beta version according both this repo and packagist. Other packages are even more confusing. If I manually update my composer.json to get version 3 of amp, and then try to install http-client by following its instructions (by running
composer require amphp/http-client
), then by default it installs an extremely outdated version of that package. Looking at the documentation, it seems to be for version 5, but looking packagist, version 5 is beta. So now I'm not sure what is the "recommended" version of http-client to use with version 3 of amp. Does the documentation always default to the recommended version or the latest development version?After further experimentation it seems amp 3 does require version 5 of http-client and that is a beta version. So the non-beta amp 3 requires beta libraries? Is amp 3 the recommended one to start out with or should I be using 2.6? My tech stack is very modern and I don't mind using developing technologies, but I don't want to use buggy technology either, I want it to have a high level of reliability.