0

I am creating my first library for Laravel Framework in github, and after the push step, i try to get the library via composer:

composer require malekbenelouafi/laravel-status

But, i always get this error:

[InvalidArgumentException]
Could not find package malekbenelouafi/laravel-status at any version for your minimum-stability (dev). Check the package spelling or your minimum-stability

This is the link of my library in github :

https://github.com/malekbenelouafi/laravel-status

Thank you.

Malek Ben el ouafi
  • 995
  • 12
  • 37

2 Answers2

2

@John-Michael L'Aller is correct you do not have a package. You should however, be able to modify your composer.json to handle this without publishing your repo as a package. You can read more about this here: https://stackoverflow.com/a/14485706/1561929.

Alex Harris
  • 6,172
  • 2
  • 32
  • 57
0

Your project isn't a composer package, it's only on Github. Composer is separate from Github and you'll have to publish your package on an aggregator like Packagist.

Go to the Packagist website and check out the instructions for "Publishing Packages".

Alternatively, if you're not ready or wanting to publish the library as a package, you should be able to modify your composer.json to handle this without publishing.

Basically, you just need to add the Github repo to the composer.json as such:

{
    "repositories": [
        {
            "url": "https://github.com/malekbenelouafi/laravel-status.git",
            "type": "git"
        }
    ],
    "require": {
        // Other required libraries
    }
}

You can read more about this option here on SO and in Composer's docs. Thanks to @Alex Harris for his answer below.