Matt Komarnicki
Matt Komarnicki

Reputation: 5422

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:

⬇️

"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?

Upvotes: 5

Views: 2864

Answers (2)

rob006
rob006

Reputation: 22174

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.

Upvotes: 5

Mike Stratton
Mike Stratton

Reputation: 475

You need to submit your Github repository to Packagist

Upvotes: 0

Related Questions