It’s time for a custom error handler. The PHP core error handler is ok, but we want more.

We will implement two error handlers.

  1. For production
  2. For development

Of course you can use the production error handler in your development environment, but you will have less information 😉

You never should use the development error handler in production, because you will output to many information about your server to the user who see the error message.

Continue reading

Summary 1

The PHPluz library should look like this:

Continue reading


It’s time to have a config class, so we can configure our project without changing code.
You should change your code only if you have to fix bugs or expand/adjust your logic, but not if you want to have other configurations (e.g. path to logfile, debug mode, etc…).

In this class we will read the configuration from an xml file.

Let’s create the default config file (this must be always there). When created copy the file and rename it to Config.xml.

Continue reading


When designing web applications, it often makes sense conceptually and architecturally to allow access to one and only one instance of a particular class. The singleton pattern enables us to do this.
The singleton pattern is useful when we need to make sure we only have a single instance of a class for the entire request lifecycle in a web application. This typically occurs when we have global objects (such as a Configuration class) or a shared resource (such as an event queue).


Continue reading