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.
- For production
- 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.
The PHPluz library should look like this:
... (Monolog library)
... (Psr Log library)
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.
Many websites must read csv files, to import customer data, to read some custom settings, etc…
We will expand this class later to set the csv options from an xml config file or a database, but for now see examples below.
Today I want to provide some (more or less) useful functions.
You will need the external libraries Monolog and Psr Log.
The documentation in the class should be sufficient to understand what the individual functions do.
Let’s start with the Autoloader.
We will create two classes:
Here arises the website PHPluz, all around PHP.
There will be useful classes, to make your work in a project easier.
Any suggestions and comments are welcome 😉