-1

I created a package and have put it on a private Packagist which fetches from private Bitbucket repo. This all works fine until I try install the package. My composer.json looks like this:

{
    "name": "XXXX/fields",
    "description": "Field processor for easy saving and updating",
    "type": "library",
    "autoload": {
        "psr-4": {
            "XXXX\\Fields\\": "src/"
        }
    },
    "authors": [
        {
            "name": "This Nerd",
            "email": "This.Nerd@XXXX.nl"
        }
    ],
    "require": {},
    "extra": {
        "laravel": {
            "providers": [
                "XXXX\\Field\\FieldServiceProvider"
            ],
            "aliases": {
                "Field": "XXXX\\Field\\Facades\\Initiators\\Field"
            }
        }
    }
}

When installing composer finds conflict with other packages:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - psr/cache 3.0.0 requires php >=8.0.0 -> your php version (7.4.19) does not satisfy that requirement.
    - zircote/swagger-php 3.2.3 requires doctrine/annotations ^1.7 -> satisfiable by doctrine/annotations[1.13.1].
    - darkaonline/l5-swagger 8.0.7 requires zircote/swagger-php 3.* -> satisfiable by zircote/swagger-php[3.2.3].
    - doctrine/annotations 1.13.1 requires psr/cache ^1 || ^2 || ^3 -> satisfiable by psr/cache[3.0.0].
    - darkaonline/l5-swagger is locked to version 8.0.7 and an update of this package was not requested.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

As you can see I'm not requiring any packages yet and have no requirements defined in my composer.json. The current version tag in the packagist is 1.0.1. When fetching composer tries "Using version ^1.0". So this all seems fine, but it isn't.

Any suggestions are welcome.

Matt
  • 1,081
  • 15
  • 27
  • 1
    Have you made a version release in your BitBucket repo? Also, the package you are trying to require can have its own set of dependencies. By the way, psr/cache according to the error message needs PHP 8 but you have PHP 7.4 – nice_dev Aug 06 '21 at 18:36
  • Just figured out that its indeed the php version. I was running composer require on the local commandline (php 7.4) whilst I needed to do so within sail (php 8.0). Make an answer with the above and I'll mark it – Matt Aug 06 '21 at 18:44
  • In my opinion, it was just a version difference to be considered. So, I will let it be. You can answer yourself if you like or probably delete the question. – nice_dev Aug 06 '21 at 20:07
  • What's the command you are running? Is this even related to that package, or to the rest of your application? – Nico Haase Aug 07 '21 at 09:28

1 Answers1

0

As nice_dev stated, the composer error was exclusively a php version error. This was due to me running it on the command line, where i run 7.4. However, I'm running sail and sail runs 8.0. So I needed to run it in sail. The reason I ran it local was because I had no ssh key on the sail server. In the end I solved this by adding a oauth key to the composer config

Matt
  • 1,081
  • 15
  • 27