How I learned the most about using XML with PHP
Kurt Höblinger Jan 13, 2018
Disclaimer: The software in question that used this solition was only used by two people - one of which was me. Only one of those two had write access - also me. This solution never was a business solution and was never used in production.
Quite some time ago, I was writing some PHP software for the web that would need to use a database. I wanted to design the software as portable as possible so that it wouldn't be too much hassle to migrate to another provider. MySQL was too big for what I wanted and while SQLite is powerful itself, I figured it would better suit my needs.
Sometimes when writing software, you run into a problem. Usually, there are multiple ways to solve it. My problem was, that I could not use SQLite in my PHP application, since my hosting provider did not allow me to install it and wouldn’t install it themselves.
Solution 1 would be to switch to another hosting provider which supports SQLite and run the program there. Solution 2 would be to search for another database system which does not require any installation at all. And solution 3 was what I chose to do: Write my own database solution.
While this has some very clear disadvantages like costing time, it has two main advantages. Firstly, you can control how the system behaves since you write it from scratch. Secondly, you gain a lot of experience by writing something you have never written before.
And that's how NWDatabase, a database system that comes with a PHP library and creates files with an XML syntax, was born. A software created while learning about XML, classes and much more. Surely not the best idea for production but not all that terrible for learning.
P.S.: This post was slightly altered after the first 24h, reacting on some comments.