add api docs + phpdoc comments