E
E
eyyuioa2020-12-01 23:59:51
PHP
eyyuioa, 2020-12-01 23:59:51

How to make changes to other people's libraries/bundles?

I have a captcha bundle in which I need to expand the functionality, add several new methods. The easiest option is to just open the sources directly in the vendor and edit the necessary classes there, but in this case, several troubles await me at once:
* deleting my code after executing the composer update command
* no one will know that the code has been modified
* the method itself looks like - it's strange
It turns out that I need to transfer all the code to the working directory of the project outside of composer'a in order to edit it without fear of deletion, if I'm right, how best to do this? If I'm not pav, then what is the adequate way to make changes to someone else's code?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2020-12-02
@eyyuioa

pull-request if the edits are useful and helpful to everyone.
if only for yourself - a fork, changing it and connecting it in the composer instead of the original.

A
Alexander, 2020-12-02
@AleksandrB

That's what inheritance is for. No changes need to be forked, requested, or anything else. You inherit the class that you need, override the necessary methods or add your own and work with it. Just about this rule Open-Closed in solid - open for extension, closed for change.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question