PHP API for Contacts

Fortsetzung der Diskussion von [Help] Is there a client API for Contacts?:

skjnldsv mentions having “custom contacts manager” for accessing nextcloud contacts via PHP. Could you please be a little more specific? I am interested in porting an existing app from Horde to Nextcloud and need access to Contacts.

For one thing, I would like to provide a html link to a specific contact in the contacts app from my app. This seems to be easy if I have the contact’s ID, but much harder if I need to calDAV-search for the person in question. Also, a pre-deletion-hook for Contacts would be nice, so I can remove linked information on my side in time.