Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

Moving Forward

Michael Cummings edited this page Jul 25, 2014 · 3 revisions

Moving Forward 2013-09-31 Edited 2014-07-25

Background

So Yapeal has been around now for about 5 years and like most software it hasn't aged as well as I would have liked. Considering it was my first try at a real project using PHP I think it has done well but in many ways it hasn't kept up and once again I have to choose between continuing with the more legacy code as is or move to something better while still holding on to the good parts that exist. I think it is also important to have some backwards compatibility as well to make migration by the existing user base of Yapeal easier.

Needed Changes

  • Better use of existing standards.
  • Use Composer for dependence management and installation.
  • Improved class loading. (auto-loader)
  • Replace ADOdb.
  • Replace cURL wrapper.

I'll cover each of these in more detail below.

Better standards use

Standards like PSR-x etc need to be used as they make both Yapeal developer, and users' lives easier. Some common standards I expect to use in Yapeal:

  • PSR-1 and PSR-2 even though I disagree with some of the code formatting they chose in some cases I'm willing to bent in the name of compatibility.
  • URI templates RFC - An official standard I had never heard of before but will be very useful I think in Yapeal.

Better dependence management and installation

In the past a lot of the issues that have come up had to do with people installing Yapeal on servers with stuff either missing or outdated that it was dependent on. I tried to solve this with install/checkForRequirements.php which had some success. This is something that Composer tries to solve as well and does a much better job IMHO.

Improved class loading

Composer comes with a PSR-4 compatible auto-loader as well which make it one more thing no one has to think about other than making sure it is started.

ADOdb must die!

Through ADOdb does work and Yapeal probably would not have got to where it is now without it, ADOdb is also legacy code that isn't very well maintained and does some very questionable things programming wise. It's been update for PHP 5.x but in name only really as at it's heart it'll forever be PHP 4.x. I have even started couple of other projects in the past to replace it but for varies reasons they never were finished.

The question is what to replace ADOdb with. Doctrine 2 is a great project started by some of the same people that made MDB, MDB2, and some other database abstraction layers. It is being use by many projects and some common PHP frameworks like Symfony 2 as well. In the end though Doctrine just is not a good match for what Yapeal does so ended up simply going with PDO instead.

New cURL wrapper

Though it's not prefect cURL works and works well. It's been around for a long time and is almost always available to be use by developers so using anything else just doesn't make much sense to me. That being said I've found it very hard to find a good OOP wrapper for it as well that has the features Yapeal needs in the past. I'm currently plan to use Guzzle as it seems like it's well written and has the features Yapeal needs. This is where I learned about the URI templates RFC so it has already proven useful.