flyingL123
flyingL123

Reputation: 8076

Will the composer update command overwrite changed files

I have a project for which I used composer install to download all of the dependancies I need. In order for one of those dependencies to work for my project, I had to make a few small changes to some of its class files.

If I run composer update again for my project, does that mean composer will re-download the original version of that package, therefore overwriting the customizations I previously made?

Upvotes: 2

Views: 1604

Answers (1)

Justin Howard
Justin Howard

Reputation: 5643

Yes, if there are updates to the original package, composer will overwrite your changes. I suggest forking the dependency and telling composer to use your fork instead.

{
    "require": {
        "vendor/the-package": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/flyingl123/the-package.git"
        }
    ]
}

You can find more instructions about forking a package in the composer docs.

Upvotes: 4

Related Questions