Question

I have a PHP composer package that requires "illuminate/support":"4.1.*" for use with Laravel 4.1 integration. I have a new Laravel project that is now at v 4.2.*. I believe I now need to update the package to require "illuminate/support":"4.2.*" (due to composer errors). How best do I maintain support for Laravel v4.1 and v4.2 in the package?

Here is my composer package's composer.jsonfile:

{
    "name": "appointedd/appointedd-php",
    "description": "",
    "authors": [
        {
            "name": "Billy Jones",
            "email": "billy@appointedd.com"
        }
    ],
    "require": {
        "php": ">=5.3.0",
        "illuminate/support": "4.1.*",
        "guzzlehttp/guzzle": "~4.0"
    },
    "autoload": {
        "psr-0": {
            "Appointedd\\Appointedd": "src/"
        }
    },
    "minimum-stability": "stable"
}

It's currently tagged at version 0.0.3. Should I update the composer.json file to require 4.2.* and tag it 0.1.0 or use a more meaningful name?

Was it helpful?

Solution

The question is what differences are between 4.1 and 4.2 that you need to support it differently. Semantic versioning should guarantee that newer minor version only introduces BC-compatible features and bug fixes.

As for your question, you can include version range in your composer.json file, as described here:

Range >=1.0 >=1.0,<2.0 >=1.0,<1.1 | >=1.2 By using comparison operators you can specify ranges of valid versions. Valid operators are >, >=, <, <=, !=. You can define multiple ranges, separated by a comma, which will be treated as a logical AND. A pipe symbol | will be treated as a logical OR. AND has higher precedence than OR.

In your situation, it would be something like:

"illuminate/support": ">=4.1.0,<4.3",
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top