GuidesPHPBuilder: How to Document Your PHP Classes

PHPBuilder: How to Document Your PHP Classes

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




“So you’ve read about how Object Oriented programming can help you with your big web projects and you’ve started it using with
PHP? If you’ve already written a handful of classes to implement a site and you’re methodic, then you should have written some
documentation about them. But If you’re just messy like me you’ve just written some comments within the classes’ source and no other
documentation. Without documentation it’s difficoult to remember methods’ names and the way they have to be used (parameters and
meaning). The typical way to solve this situation is to have source code files open and to skim through hundreds or thousands of lines.”

In my opinion maintaining a documentation as a reference within source code is easier and more practical than having to do it in a separated document
because in this way it’s easier to keep it updated. Otherwise it’s very easy to become lazy and postpone updates in the documentation to a time that never
comes. Instead with a tool like this there is the little burden to update a tag near the source code you’ve just modified and to run the tool to generate again
the updated html pages.

“There must be a better way — if you are used to the Java language you will know the Javadoc documentation system. This tool allows
you to insert tags within comments of your source files that are then parsed by Javadoc tools in order to generate a set of HTML
pages documenting your classes. So while you program you can keep your browser open and you’ll have a list of your classes and methods with descriptions.
This will become your reference to be more productive and fast while building your web application.”

“In my opinion maintaining a documentation as a reference within source code is easier and more practical than having to do it in a separated document
because in this way it’s easier to keep it updated. Otherwise it’s very easy to become lazy and postpone updates in the documentation to a time that never
comes. Instead with a tool like this there is the little burden to update a tag near the source code you’ve just modified and to run the tool to generate again
the updated html pages.”

Want to discuss PHP with other Apache Today readers? Then check out the PHP discussion at Apache Today Discussions.

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories