hootlex / laravel-friendships

This package gives Eloquent models the ability to manage their friendships.
MIT License
706 stars 151 forks source link

Composer install hootlex requires version ~5.* #143

Open swietek opened 3 years ago

swietek commented 3 years ago

Hi, I have an existing laravel project and wanted to add a new package for creating pdf. Unfortunately I always get this error when I require any package with composer

  [RuntimeException]
  Could not load package hootlex/laravel-friendships in http://repo.packagist.org: [UnexpectedValueException] Could not parse version constraint ~5.*: Invalid version string "~5.*"

  [UnexpectedValueException]
  Could not parse version constraint ~5.*: Invalid version string "~5.*"

It is very weird because of the version, when I remove the package I can install the pdf package. But I cannot install hootlex/laravel-friendships package anymore as I'm getting the same error as described above.

TechTailor commented 3 years ago

Can you provide more information about your environment/app? Laravel Version, PHP Version, ServerType, etc. Would help in debugging the issue.

-TT

swietek commented 3 years ago

PHP v. 7.3.11 on command line Developing locally with Homestead / MySQL

composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "bacon/bacon-qr-code": "1.0.3",
        "barryvdh/laravel-dompdf": "^0.8.5",
        "barryvdh/laravel-ide-helper": "^2.6",
        "barryvdh/laravel-snappy": "^0.4.8",
        "bitbeans/yubikey": "dev-master",
        "doctrine/dbal": "^2.8",
        "enso/activation": "^0.3.0",
        "fideloper/proxy": "^4.0",
        "kepex/laravel-crud-generator": "^0.1.7",
        "laravel/framework": "^6.0",
        "laravel/helpers": "^1.1",
        "laravel/tinker": "^1.0",
        "m3rten/laravel-double-opt-in": "^0.1.1",
        "monarobase/country-list": "^2.1",
        "monolog/monolog": "^1.24",
        "nahid/talk": "^2.2",
        "paragonie/constant_time_encoding": "^2.2",
        "pragmarx/google2fa": "^3.0",
        "pragmarx/google2fa-laravel": "^0.2.0",
        "spatie/laravel-backup": "^6.0",
        "spatie/laravel-medialibrary": "^7.3",
        "vimeo/laravel": "^5.2"
    },
    "require-dev": {
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Hope that helps for debugging. As mentioned in this state I try to add the hootlex package

TechTailor commented 3 years ago

This package only has support for Laravel 5.x versions. Unfornately this package has not be updated to work with Laravel 6 & PHP 7+ even though some pr's for the same were submitted.

If you still want to use this package, you'd need to downgrade to Laravel 5 or find an alternative.

-TT

thijskuilman commented 3 years ago

I've got the same error since yesterday, even though I'm running Laravel 5.x

TechTailor commented 3 years ago

I've got the same error since yesterday, even though I'm running Laravel 5.x

Your PHP version? This repo hasn't been updated/changed in a very long time. So if anything stops working, its cause you updated something to the newer version (anything released within the last 18 months is definitely not compatible), say for example your PHP version.

Also are you requiring through composer or adding manually to the composer.json file ?

-TT

DHeymann commented 3 years ago

I've got the same error. Running Laravel 5.6 and PHP 7.2.10

TechTailor commented 3 years ago

This package was last maintained during Laravel 5.4 with PHP v5.4. You cannot run this package on PHP7 as it will give you certain runtime exceptions.

Since this package is now abandoned, I will be forking it and creating a updated version with support for Laravel 8 sometime next weekend.

DHeymann commented 3 years ago

Thanks - I understand. The only strange thing is that it worked for a very long time with the same PHP / Laravel version. The last deploy i did 2-3 weeks ago. Nothing has changed in the Laravel friendships code for 2 years. And we haven't changed anything relevant in our project either (just some css). but today i got this error (...Could not parse version constraint ~5.: Invalid version string "~5....) for the first time.

thijskuilman commented 3 years ago

That's the weird thing for me as well. I've worked with this package about a week ago with the same development setup (PHP 7.3) and it worked fine until a few days ago.

TechTailor commented 3 years ago

Ok. So since it was working fine until recently, I did quick google search and found a probable bug in composer that was reported ~2 weeks ago. Refer https://github.com/composer/composer/issues/9191

If you updated composer recently, run composer selfupdate --rollback and see if it fixes the issue.

DHeymann commented 3 years ago

I will try this. Thank you

jwittekind commented 3 years ago

Unfortunately i'm unexpectedly getting the same error:

[RuntimeException]
  Could not load package hootlex/laravel-friendships in http://packagist.org: [UnexpectedValueException] Could not parse version constraint ~5.*: Invalid version string "~5.*"

  [UnexpectedValueException]
  Could not parse version constraint ~5.*: Invalid version string "~5.*"

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowes
t] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

Could you share your solution?

TechTailor commented 3 years ago

Refer to my previous reply, if you havn't updated your PHP version recently, it most likely a composer bug, see if your composer was updated recently, if so do a rollback.