I need in my controller to calculate the time in the car as well as the distance between two addresses, so in PHP.
I’m on Symfony 4. So I’m looking for a bundle that allows me to do this.
I was on packagist, and I did not find anything that meets my expectations for Symfony 4, except this bundle: https://packagist.org/packages/fungio/google-map-bundle
But when I try to install it to test (him or all the other bundles related to google map), I get this kind of error:
Could not find a version of package fungio/google-map-bundle matching
your minimum-stability (stable). Require it with an explicit
version constraint allowing its desired stability.
EDIT: I added “minimum-stability”: “dev” in my composer.json. The bundle is correctly downloading but I’ve this error now :
Symfony operations: 1 recipe (51cd62f67b65662de716f98b007199d1)
- Configuring fungio/google-map-bundle (>=dev-master): From auto-generated recipe
Executing script cache:clear [KO]
[KO]
!!
!! In ParameterBag.php line 100:
!!
!! You have requested a non-existent parameter "templating.engines".
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
Installation failed, reverting ./composer.json to its original content.
And if I try to download an other bundle like https://packagist.org/packages/geocoder-php/google-maps-provider
I’ve now :
composer require geocoder-php/google-maps-provider
Using version ^4.0@dev for geocoder-php/google-maps-provider
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Your requirements could not be resolved to an installable set of packages.
Problem 1
- geocoder-php/google-maps-provider 4.0.0 requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/google-maps-provider 4.0.0-beta1 requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/google-maps-provider 4.0.0-beta2 requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/google-maps-provider 4.1.0 requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/google-maps-provider 4.2.0 requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/google-maps-provider 4.3.0 requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/google-maps-provider 4.4.0 requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/google-maps-provider 4.0.x-dev requires geocoder-php/common-http ^4.0 -> satisfiable by geocoder-php/common-http[4.0.0, 4.0.0-beta1, 4.1.0, 4.2.0, 4.0.x-dev].
- geocoder-php/common-http 4.0.x-dev requires psr/http-message-implementation ^1.0 -> no matching package found.
- geocoder-php/common-http 4.2.0 requires psr/http-message-implementation ^1.0 -> no matching package found.
- geocoder-php/common-http 4.1.0 requires psr/http-message-implementation ^1.0 -> no matching package found.
- geocoder-php/common-http 4.0.0-beta1 requires psr/http-message-implementation ^1.0 -> no matching package found.
- geocoder-php/common-http 4.0.0 requires psr/http-message-implementation ^1.0 -> no matching package found.
- Installation request for geocoder-php/google-maps-provider ^4.0@dev -> satisfiable by geocoder-php/google-maps-provider[4.0.0, 4.0.0-beta1, 4.0.0-beta2, 4.1.0, 4.2.0, 4.3.0, 4.4.0, 4.0.x-dev].
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.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
2
Answers
You should try to add a minimum-stability to dev in you composer.json
Your problem is with composer, not Symfony. As the error message mentions, composer can not find a stable version of the package.
If you are the maintainer then you can tag a version and packagist should update the page and show it as stable version or you can ask them to tag a release.
If you want to rely on the unstable version you can require the package with
@dev
like this:See: https://getcomposer.org/doc/04-schema.md#package-links
Alternatively, you can modify your composer.json and set the minimum stability for dependencies to dev, but be aware that this might cause you to install unsafe packages accidentally.
See: https://getcomposer.org/doc/04-schema.md#minimum-stability
Your second composer issue is a bit tricky to decipher, but this line here is the hint:
Your dependency
geocoder-php/google-maps-provider
relies on another dependency which requires an implementation for a PSR HTTP-Message. The packagepsr/http-message-implementation
is only a virtual package and you have to pick an implementation that provides the required code. If you look for the package on packagist.org you can find multiple implementations. I can recommendguzzlehttp/psr7
ornyholm/psr7
but there are plenty more to choose from. Your command should then probably look something like: