0

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.

Kamran Ahmed
  • 11,809
  • 23
  • 69
  • 101
  • `composer require "kamranahmedse/php-geocode=dev-master"`. You need to fetch the development master branch, you have no tags or releases. – N.B. Oct 07 '14 at 12:29

1 Answers1

6

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.

Kevin M Granger
  • 2,375
  • 23
  • 28
  • 2
    The correct answer is to tag a version instead. Working with branches is a pain for everyone, Stackoverflow is full of questions dealing with the negative side effects of not being able to use tagged versions. – Sven Oct 07 '14 at 18:07
  • 1
    @Sven I think it's fine to work with branches during the infancy of a project or in an experimental fashion, as long as one understands and uses the `composer.lock` file. – Kevin M Granger Oct 08 '14 at 19:02