PDO would allow this to be database-agnostic, and while it's refactored to support PDO, it should be implemented in a more modular way.
-
create a Connection class and store each database connection there. This will make url-shortener more portable, because other projects are more likely to have a modular approach to creating & managing database connections.
-
place the SQL statements in separate methods within the UrlShortener class. This, combined with the use of bindParam(), is a best-practice.
I've cloned the project and partially finished these changes. If you want, we could create a branch and I could push my current changes to it so we can work on it before pushing it to the master branch.
PDO would allow this to be database-agnostic, and while it's refactored to support PDO, it should be implemented in a more modular way.
create a Connection class and store each database connection there. This will make url-shortener more portable, because other projects are more likely to have a modular approach to creating & managing database connections.
place the SQL statements in separate methods within the UrlShortener class. This, combined with the use of bindParam(), is a best-practice.
I've cloned the project and partially finished these changes. If you want, we could create a branch and I could push my current changes to it so we can work on it before pushing it to the master branch.