2

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?

flyingL123
  • 7,686
  • 11
  • 66
  • 135

1 Answers1

4

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.

Justin Howard
  • 5,504
  • 1
  • 21
  • 48
  • it is possible to [fork in a private repository](http://stackoverflow.com/questions/8137997/forking-from-github-to-bitbucket) in case the changes you need to do are to be private, ie contain business logic or business-related informations. the procedure is also explained in the link on forking a package. – Félix Adriyel Gagnon-Grenier Oct 13 '15 at 18:24