You should take a look at the Swagger application, as already mentioned by @zim2001. It has a Swagger-ui component, which is a simple html and javascript application reading the json data recorded by the backend application. There are adapters for number of languages, including php and java.
If you are using the Symfony2 framework for PHP, here's ready-to-use bundle for automatic generation of the RESTful service documentation:
- https://github.com/nelmio/NelmioApiDocBundle
One thing I don't like about such generators is the lack of translations, so if you want to provide the documentation of your API exposed over RESTful services on many languages - you cant.