0

I'm worrying about Laravel and long term support concepts, related to my application.

Now I've developed my app on lrvl 5.2, but the LTS version is the 5.1. Since I'd like to have a long term supported framework as my application basement, I wonder if it's the case to downgrade to 5.1. No features problems should arise for my specific app. But this is another story... not the topic of this question.

Secondly I don't see how to tell composer to stick to laravel 5.1 then, i.e. when I'll run a composer update avoid updating the laravel 5.1 version.

Should I also worry about tweaking composer from updating the dependency packages?

koalaok
  • 5,075
  • 11
  • 47
  • 91

1 Answers1

1

In your composer.json, find and edit this line:

"laravel/framework": "5.1.*",

That is how you force Composer stick with a specified version. Hope it helps.

For more information: https://getcomposer.org/doc/articles/versions.md

composer.json for Laravel 5.1 LTS

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}
Toan Nguyen
  • 911
  • 13
  • 35
  • since now there's "laravel/framework": "5.2.*" and I think the other listed packages/version dependencies are written in the composer file as dependencies of 5.2 version and not the 5.1, isn't it going to break? (I believe after making changes I'll need to perform a composer update command?) Thanks – koalaok Apr 21 '16 at 08:55
  • In theory, the answer is **No**, Composer will try to find the compatiable version of other dependencies for you, automatically. Check my answer to view the full of composer.json for 5.1 LTS. – Toan Nguyen Apr 21 '16 at 08:59
  • It is important to know that Laravel does NOT follow semantic versioning, so the differences between two minor versions may break stuff. This is the reason you should either have enough tests, or limit Composer to only update within the patch range, like `5.1.*` or `5.2.*`. Avoid the tilde or caret operators: `~5.1` or `^5.1.4` will all try to update to 5.2 and beyond. – Sven Apr 21 '16 at 18:55