composer | laravel 5 - Updating dependencies but the framework itself

11,568

Solution 1

While the composer update package package ... answer is a good one, another thing you might be able to do is change your Laravel require spec to a specific commit. The Composer documentation mentions how to do this, and I've done it myself on a project (though not with laravel, on my own packages which are also in a breaking/dev state).

"require": {
    "laravel/framework": "dev-master#49e3c77b518547bb661b1de4fda64a3ae0c5c505",
    ...
}

I'd hope that, because laravel/framework 'replaces' the various illuminate/* packages, that any reliance on these (as long as the spec is 5.0-esque) that this would work without downloading the illuminate packages twice.

Doing it this way you can lock your laravel/framework (or any package) at a given commit, but still allow the standard composer update to work.

To find out what commit you're already on, if your laravel/framework dependency spec is a dev one then the vendor/laravel/framework/ directory itself should be a git repo, so just do git status in there to get the HEAD ref. Alternatively, look in composer.lock for the laravel/framework entry's source.reference value.

Solution 2

Composer allows you to do specific package upgrades. I used this literally the other night to upgrade a single package to fix a bug, but I didn't want to change anything else.

composer update <package1> <package2> <...>

So in your case

composer update phpunit/phpunit way/generators fzaninotto/faker

It might be more complicated when you have lots of packages - but it is a solution that works.

Solution 3

Yes, you can simply call

composer update vendor/package

without updating your whole project.

It will work for the packages pulled by yourself and for the dependencies

Share:
11,568
aBhijit
Author by

aBhijit

I am a software developer based in Mumbai, India. My specialization lies in website designing, developing web and mobile applications. Technology has always kept me curious and inquisitive and has inspired me to pick up an empirical approach to every aspect of my professional life. The passion that I have cultivated for logic and structure of coding was the motivating factor for me to strive forward and write efficient code. I like to take up challenging problems and convert them into beautiful solutions.

Updated on June 04, 2022

Comments

  • aBhijit
    aBhijit over 1 year

    I am using pre-beta release of Laravel 5 for my project.

    I found out that the app skeleton of Laravel 5 was changed in the github repo and since it is a development version, that is expected to change quite frequently.

    My question is, can I update only the specific dependencies using composer and not the framework itself? So that I don't have to worry about the changing app structure until I am ready to make changes?

    Here is how the composer.json dependencies look:

        "require": {
            "laravel/framework": "~5.0"
        },
        "require-dev": {
            "phpunit/phpunit": "~4.0",
            "way/generators": "~3.0",
            "fzaninotto/faker": "~1.5@dev"
        },
    

    Thank you.