Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start versioning a composer package?

I'm starting to develop a package that i'd like to open source and use in future projects. I don't understand the proper steps to get this started though.

I've just created the repository on github and here is my composer.json

{
    "name": "ProgrammingAreHard/Arbiter",
    "license": "MIT",
    "type": "library",
    "description": "Convenience library to manipulate Symfony ACL's",
    "authors": [
        {
            "name": "David Adams",
            "email": "[email protected]"
        }
    ],
    "autoload": {
        "psr-0": {
            "ProgrammingAreHard\\Arbiter": "src/"
        }
    },
    "require": {
        "php": ">=5.3.3"
    },
    "require-dev": {
        "symfony/security": "2.4.*",
        "phpunit/phpunit": "~4.0"
    },
    "minimum-stability": "dev",
    "target-dir": "ProgrammingAreHard/Arbiter",
    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    }
}

I'm having a tough time wrapping my head around versioning though. I haven't made any git tags. I've put the branch-alias on just because i hear that it's a good practice. I'm not sure 1.0.x-dev is what should be there right now.

What should i do at this point? I'm not at a point where i'm comfortable with a 1.0 version. Should i create a lightweight or annotated git tag at something like "v0.1.0" immediately or wait until i'm at a point where it's fully functional?

What should i be doing so that it's not a headache later?

I'm assuming composer uses git tags for versioning(?)

like image 885
David Avatar asked Apr 29 '14 03:04

David


People also ask

How do I find my composer package version?

You can test version constraints using semver.madewithlove.com. Fill in a package name and it will autofill the default version constraint which Composer would add to your composer. json file. You can adjust the version constraint and the tool will highlight all releases that match.

How do I update my composer specific version?

To change to version one run the self-update command and pass in the --1 flag. This will change composer to version one and now you can install your dependencies. Once you have installed your dependencies, now you can run the same command and pass in --2 as the flag and this will switch back to composer version 2.


1 Answers

In doubt (since you can chose any policy you want), you can refer to semantic versioning 2.0

Major version zero (0.y.z) is for initial development. Anything may change at any time.
The public API should not be considered stable.

As long as your public API can change, stay in 0.x.y.

like image 169
VonC Avatar answered Sep 21 '22 10:09

VonC