The annotationHandler.php file, though it is in the /lib/html5 folder, is not actually part of WebViewer, and is provided mainly for demonstrative purposes. PHP was chosen as most servers support running PHP, and this is the simplest way to setup and run.
In the end the file is just handling POST and GET requests, and writing to disk. The top of the file contains a description of the functionality and suggests next steps.
We cannot provide other sample code, as then it becomes very dependent on your particular server setup (JBoss, IIS, WAMPP, XAMPP, etc), and often much more configuration.
Typically we see customers reading/writing the XFDF to their database (using the document_id and also a user_id (not included in sample)). Again, exact code would depend on your database technology.