-1

I have a problem.

I want to get package from composer. After that i want to edit that package, remove dependency from composer.json and to have edited version in vendor. But after I remove require from composer.json and start composer update, my edited package is removed. Is there any way to have 'edited' package in vendor and disable composer update from removing it?

2 Answers2

0

vendor directory should be managed by Composer. Basically you should be able to remove this directory completely and restore it by simple composer install. This means that your vendor directory should not contain content, that could not be restored by Composer.

You may copy this package outside of vendor and make it part of your project. But probably better option would be to fork this package and use your fork in project instead of original package. See How to require a fork with composer.

rob006
  • 21,383
  • 5
  • 53
  • 74
0

The best way is to write a wrapper for the extension, that you want to extend or change, and put it outside the vendor directory.

For instance

class MyVendorClassWrapper extends VendorClass{

    function myFunctionality(){
        // your code goes here
    }
} 
Wolfgang Blessen
  • 900
  • 10
  • 29