why prosper?
Choosing to use a library on a project is a big decision, so why user prosper?
Prosper was written for an actual project to solve an actual problem. It’s not an academic experiment, it is meant to solve a real world problem in a real world way. There were a few over arching design decisions made up front that greatly impacted the end product.
- Transparent – The translation between prosper code and the sql it generates is straightforward and should never surprise you.
Query::select()->from('user')->where("name = 'Matt'");--Using the MySQL backend select * from `user` where `name` = 'Matt'
- Don’t Repeat Yourself (DRY) – There should be one place for everything. You configure prosper once and then never think about it again. Escaping values is a common attack vector with sql injection attacks. In a large project you can easily have thousands of sql statements that all require proper escaping to maintain the integrity of your application. Missing a parameter is an easy thing to do, preventing it requires 100% coverage of mysql_real_escape_string or whichever function your backend uses. This is repeating yourself in the worst way, prosper automatically handles this aspect for you.
- Consistency – The API was designed to be consistent, not just across backends, but internally. Function calls strive for similarity and if a backend lacks functionality it is handled by prosper code.
- Opt Out – Sometimes no matter how good a library is, you have to work around it, and that should be easy. Prosper allows you to easily work around it with the native function. Native allows you to run arbitrary non-cross platform code for those sections where you need to squeeze out every last drop of backend horsepower.
- Extensible – Adding a new backend should be simple and striaght forward. The adapter architecture means that a new adapter can be created quickly and easily by implementing a few key callback functions.
Prosper solves the very real problem of inconsistent backend interfaces. It is a simple way to increase your install base by removing the database issue. Hundreds of hours of work went into creating a consistent backend API from many conflicting and complicated APIs.
Check out the case study, read up the documentation, and get the code.