Hooks/OCP Events manual or tutorial


Currently developing app for nextcloud to sync files with gitfs using hooks(seems deprecated)/OCP events
Searching for good tutorial or detailed manual with information how to write OCP events on nextcloud
Now methodology of developing app using OCP is unclear

Could anybody help with that?
Thank you for answers!