Pratical Examples in API Documentation

I find an enormous resource every time I’m working on an application. But one thing it lacks, and the one which I feel is very important, is practical examples of functions being used. has done a great job by leaving this to users (it is debatable of course). Each time someone is confused with a function or wants to look up advanced functions in PHP’s official website, there is not only documentation available but also good number of examples given, which, a user can directly relate to his code. It serves the purpose of learning the API greatly.

I just feel if we can do something similar on this website, many people will benefit from it. Because, theory is important, no doubt, but a demo of practical application can make the toughest concepts easy to understand.

All users can post comments on the API pages… so it’s up to the users to post some good examples… some are already there…

That is true, but it’s really different from what I am suggesting.

If, for example, I’m looking for examples of using findByAttributes() at, the documentation contains only the theory of 8-10 lines. It is not practical to scroll all the way down to see if there is any example available, every time I want to look up a particular function. This is because the page is not specific to that particular function. So, along with existing theory for that function, if we have a small button at the end of it, which, upon clicking, shows all the examples of using findByAttributes(), wouldn’t it be great?

Here’s an example of the same,

Mike has replied with an excellent example of using findByAttributes(). It is also clear that users are looking for such kind of data.

It is just an idea that can help everyone immensely.

<br /><br /><br />

I have the same problem too it can help new bibs and it’s better examples add by developer team not end users