PHP is written in text files which can be managed using any number of version control systems. Pick your poison.
https://en.wikipedia.org/wiki/List_of_version-control_software
As someone else said, you can document your patches with a Docker file, but you'll still need to track your changes.
Ultimately, what you're essentially doing is maintaining a local fork of the code and keeping it synchronised with upstream.
all 7 comments