Posts tagged ‘Documentation’

REST Service documentation with PHPDocumentor

I’ve just been hacking around with PHPDocumentor getting it to automatically create the documentation for the Cohere API and seems to be working well.

I have apilib.php which contains the PHP calls to the functions, then service.php is a wrapper around the apilib.php and provides the actual REST based services. Service.php is basically just a big switch statement, so, since PHPDocumentor needs the function declarations I can’t actually base the service documentation on service.php, so I’m using apilib.php as the basis for the service documentation.

I created my own PHPDocumentor template, which has been straightforward enough, though I did come across a couple of little issues – nothing too big and nothing that can’t be worked around .

These were the 2 little hacks I needed to put into my template:

  1. in apilib, I’ve named the functions using camel case, whereas the actual method calls in service.php need to be lower case – so I amended the stylesheet to use: {text-transform:lowercase;} where the function name was displayed
  2. I also needed to remove the dollar signs from the front of all the PHP parameters, so to do this I just used the Smarty templating command ‘replace’: {$functions[func].params[params].var|replace:’$':”}

I still have some of the documentation to actually write into apilib.php – most notably example service calls for each method and double checking the return descriptions are consistent (and correct). All is working out well and you can see the generated docs on the Cohere site.

Thursday 23 February 06

I have now posted up our notes from the meeting last week, and you can find them here: http://kn.open.ac.uk/public/document.cfm?docid=7581 These notes reflect our thinking at the time, and how the system should be developed, based on the components we thought to be already available (and their functionality). Some our thinking, and the work we’ll have to do, has changed as we’ve done more research (see the blog postings over the last few days). So once we’ve had chance to spend more time doing this research (especially on IMS Enterprise and Moodle groups), we’ll be able to provide a more realistic picture of what we’ll develop.