When developing for Moodle a best practice is to use the libraries available when writing your code. When you write a Moodle plugin: a block, module, report, custom certificate or whatever you will need to use Moodle libraries to communicate with the Moodle core.
Moodle has many libraries that are always available in your plugin. These libraries are stored in your lib folder. Others need to be included in your plugin using a require_once line or similar.
Finding your way in Moodle code takes time, reading the dev documentation on Moodle.org is a good start an working on copies of existing plugins helps you get started quickly.
You can browse your Moodle code using a PHP editor like Eclipse, Notepad++, Geany or many others. Another way of finding your way around Moodle code is using PHPXref. This is a set of script that take the php documentation included in Moodle and put it into a searchable structure that show you where functions are defined and used.
You can download PHPXref, download a fresh copy of Moodle and start building the documentation yourself. Or you can use this link to browse the Moodle code.
How to use PHP XREF: For a plugin I was writing I needed to send emails to users about a offline session that was planned. Moodle has a SMTP server configured and can send emails. I just needed to know how Moodle sends emails and how these functions work.
Most basic moodle functions are defined in /lib/moodlelib.php. Most libraries in the /lib folder have a descriptive name so finding your functions is often easy. If you are totally lost use a command line find / grep operation. Searching for my email function i started opening moodlelib.php in xref:
In my browser search I typed: email. After a few searches I found a function that matches the action I want to perform: email_to_user.
After clicking on that link I go to the function documentation
Clicking on the link “email_to_user” again brings me to the actual code so I can inspect it’s inner working.
Now try for yourself using this link: PHPXref Moodle 2.4.1 documentation
If you want a zipped copy of this xref doc send me a message on twitter: https://twitter.com/basbrands