url-shortener-php
url-shortener-php copied to clipboard
Refactor for PDO & Modularity
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.
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.
@runninguru Great! Let me know when you are done with the changes.
I'm finished with the changes. If you create a branch, I can make a pull request to that branch so you can review what i've done before you merge it with the master branch.
@runninguru you can push your changes in the develop branch for the review.