Search code examples
composer-phppackagist

packagist / composer - Assign a version number


I have people using my pacakgist library.

I want to make sure that their composer.json version requirement stated as "dev-master" will not get updated when they run composer update... as I have changed the underlying architecture of the package.

How do I assign a new versioning to my new update? so that they have to explicitly say I want v1.01 I currently have the composer.json as:

{
    "name": ...,
    "type": "library",
    "description": ...,
    "keywords": ...
    "homepage": ...,
    "license": "MIT",
    "authors": [
        ...
    ],
    "require": {
        "php": ">=5.3.0"
    },
    "autoload": {
        "classmap": ["Models/"]
    } 
}

Solution

  • The composer documentation recommends specifying the version using a VCS tag. With git this looks like

    git tag -a 1.0.0 -m 'Your tag message'
    

    This will tag the HEAD of your current branch with the version 1.0.0. Then do

    git push --tags
    

    Once your package gets crawled again, the version should be available on packagist.