jmikola / geojson

GeoJSON implementation for PHP
MIT License
295 stars 47 forks source link

Installation guidelines for composer should be updated #15

Closed Conradaek closed 10 years ago

Conradaek commented 10 years ago

In https://github.com/jmikola/geojson#installation

From:

$ composer require "jmikola/geojson=~1.0"

to


"jmikola/geojson": "1.0.*@dev"

I have figured it out now but before I have downloaded with composer an old version with some bug. I even wrote an issue post with how to solve this bug! ;)

jmikola commented 10 years ago

I don't understand the issue here. composer require "jmikola/geojson=~1.0" is a console command that adds a requirement for the given package and version to composer.json, creating the file if necessary.

"jmikola/geojson": "1.0.*@dev" would be a line to add to an existing composer.json file, although @dev allows for unstable versions to be pulled in, which isn't ideal.

Conradaek commented 10 years ago

Hmmm. Ok, mayby I mistunderstood sth (i am kind of begginer) but the thing is my composer.json file was:

{
    "require": {
    "jmikola/geojson": "1.0"
    }
}

With such composer.json file some older version was downloaded. E.g. the version have this bug https://github.com/jmikola/geojson/commit/eb1177a58757bca4614e3ef84760a7324fbe86ca

So how should I build my composer.json file?

Conradaek commented 10 years ago

I have just started to using your library but want to say it's awesome! ;)

jmikola commented 10 years ago

With such composer.json file some older version was downloaded. E.g. the version have this bug eb1177a

Got it. That's entirely my fault for not tagging a release with that bug fix. I'll do so soon as 1.0.1.

If you're using "jmikola/geojson": "1.0" in composer.json, you will indeed be stuck on 1.0. The benefit of using ~1.0 is that Composer will happily accept new versions up to but not including 2.0 (see: Composer docs). Alternatively, you could be more selective and say 1.0.*, which would allow any patch releases in the 1.0 series but stop short of 1.1.

For packages respecting semantic versioning (which I'm trying to do here), using the tilde operator (e.g. ~1.0) is usually preferable, as you can get new functionality without worrying about BC breaks.

jmikola commented 10 years ago

Tagged: https://github.com/jmikola/geojson/releases/tag/1.0.1

Thanks for bringing this up.