Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use fork repository in my Laravel project - "Could not find a matching version of package"

I made my fork (https://github.com/digital-bird/LaravelShoppingcart) of someone's fork (https://github.com/hardevine/LaravelShoppingcart).

I want to use my fork in my Laravel project + I want to modify it in the future.

1) I removed the hardevine's fork from this project via composer remove hardevine/shoppingcart

2) Then I modified composer.json in my fork with:

  • new name: "name": "digital-bird/shoppingcart",
  • new author
  • under require I added: "hardevine/shoppingcart": "dev-master",
  • finally I added repositories section:

⬇️

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/digital-bird/LaravelShoppingcart"
    }
],

so new package.json of my fork looks like: https://github.com/digital-bird/LaravelShoppingcart/blob/master/composer.json

3) I pushed this to my fork's master branch

4) I went to my Laravel project and I typed:

composer require digital-bird/shoppingcart

I'm getting the big red error:

[InvalidArgumentException] Could not find a matching version of package digital-bird/shoppingcart. Check the package spelling, your version constraint and that the package is ava ilable in a stability which matches your minimum-stability (stable).

What am I doing wrong?

like image 951
Matt Komarnicki Avatar asked Jun 05 '19 01:06

Matt Komarnicki


1 Answers

You should add this:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/digital-bird/LaravelShoppingcart"
    }
],

to composer.json of your main Laravel project instead of your library. Also adding "hardevine/shoppingcart": "dev-master", seems to be pointless and it probably will create some conflicts.

like image 86
rob006 Avatar answered Sep 26 '22 13:09

rob006