Search code examples
phpcomposer-phppackagepackage-managerspackagist

Why can't I download my package through packagist?


I have developed a library and I decided to throw it to the packagist. My composer.json looks like the following

{
    "name": "kamranahmedse/php-geocode",
    "type": "library",
    "description": "A wrapper around the Google Geocoding API to get different details such as latitude, longitude, country, city, district, postcode, town and street number regarding some specific address.",
    "keywords": ["location", "address", "addresses", "google", "map", "maps", "gmap", "gmaps", "geocode", "geocoder", "geocoding"],
    "homepage": "https://github.com/kamranahmedse/php-geocode",
    "license": "MIT",
    "authors": [
        {
            "name": "Kamran Ahmed",
            "homepage": "http://kamranahmed.info",
            "role": "Developer"
        }
    ],
    "autoload": {
        "psr-0": {
            "Geocode": "src/"
        }
    },
    "require": {
        "php": ">=5.2.0"
    }
}

and I have hosted my package at https://packagist.org/packages/kamranahmedse/php-geocode and the associated git repository is https://github.com/kamranahmedse/php-geocode. Now to test if my package is working fine, what I did was create a folder. Inside that folder I created this simple composer.json file containing

{
    "require": {
        "kamranahmedse/php-geocode": "*"
    }
}

But whenever I try to run composer install, I'm getting the following error:

Your requirements could not be resolved to an installable set of packages.

Problem 1 - The requested package kamranahmedse/php-geocode could not be found in any version, there may be a typo in the package name.

Can anyone please have a look and see what I'm doing wrong here? I've been trying and trying but unable to find any errors as this would be my first package over packagist and I have no prior experience.


Solution

  • I belive it's because you don't have any stable releases, and composer defaults to only downloading stable releases when * is specified.

    Either change your version specification to dev-master or set your minimum-stability to dev.