The PHP manual
Sydney PHP Group presentation
Finding and using the PHP manual
What is the PHP manual?
- It's a repository of all things PHP, including (but not limited to)
- PHP basics
- installation
- function reference
- notes on general development considerations such as security
- a developer reference
- As we're focusing on web development with PHP, this presentation will focus on the language reference, the function reference plus some parts of the installation guide that assist in better development practices.
- Note : we're talking development environment here. Some of the practices outlined should never be used in a production environment.
Why use the PHP manual?
- it can greatly assist you in debugging
- it can give you ideas on better development techniques
- you can contribute your own notes to the manual
- from the user notes you can get an idea on how other developers implement PHP (sometimes badly)
Why a discussion on the PHP manual?
- it's one of the most overlooked parts of PHP development
- In development, documentation is king
- the great majority of questions asked have answers found in the manual
- it'll help our sydphp.org search engine rankings
Where do I find the PHP manual?
- The PHP manual can be viewed at php.net/docs.php
- Downloadable versions can be retrieved via php.net/download-docs.php
- The downloadable HTML versions can be viewed on the local filesystem or installed within the public html document root of a web server
- The CHM version is especially suitable for those developing on Windows desktops. It can include user notes.
The language reference
- Is information on how to code with PHP
- I'll refer to the manual here for some examples
The function reference
- Includes descriptions of all PHP core functions and functions from external libraries
- Using IMAP as an example... (php.net/manual/en/ref.imap.php) ... I'll run through the general gist of a function reference
Using it within your development environment
- This part of the presentation shows how to incorporate the manual into your development environment
- To continue I'll refer to my own local set up
- Setting up a simple vhost to hold the manual (remember the hosts file!)
- The PHP ini file
- Error display
- Manual link
- Fancy messages with CSS
- Note : In a production environment you should turn all of this off. Errors and warnings are best left to syslog.
Tips and Tricks
- Did you know ....
- You can type in php.net/blah and get straight to the page you want?
- You can set up your own version of the manual by mirroring the PHP website, described here: php.net/mirroring
In Summary
- Use the PHP manual, it is your friend in development
- Read the manual before asking questions, it will save you a lot of time.
- Contribute to the manual where appropriate