Ad

InvalidArgumentException Composer When Installing Laravel Package Via Composer

- 1 answer

I've created a package in laravel with laravel packager, I push it to my github account and also submit to Packagist. When I hit

composer require mortezarajabi/jdate

in root directory, I get the

    [InvalidArgumentException]                                                   
      Could not find package mortezarajabi/jdate at any version for your minimum-  
      stability (stable). Check the package spelling or your minimum-stability
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...

and this is my composer

{
    "name": "mortezrajabi/jdate",
    "type": "library",
    "description": "Jalali(Falaki) date for laravel",
    "keywords": [
        "mortezarajabi",
        "jdata"
    ],
    "homepage": "https://github.com/mortezarajabi/jdate",
    "license": "MIT",
    "authors": [
        {
            "name": "mortezarajabi",
            "email": "[email protected]",
            "homepage": "http://mortezarajabi.com",
            "role": "Developer"
        }
    ],
    "require": {
        "illuminate/support": "~5",
        "php" : ">=5.4.0"
    },
    "autoload": {
        "psr-4": {
            "rajabi\\jdate\\": "src"
        }
    }
}

any suggestion?

Ad

Answer

The problem is that you don't have any tag for your package in Git. Packagist uses tags for package versioning. It will use your latest tag as a default version in composer require mortezarajabi/jdate.

So if you just want to work with master branch, you can require it in your composer.json as follow:

"require": { "mortezarajabi/jdate" : "dev-master" }
"minimum-stability": "dev"

And then you can:

composer update
Ad
source: stackoverflow.com
Ad